SF.net SVN: geany: [2659] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Sun Jun 8 12:18:21 UTC 2008
Revision: 2659
http://geany.svn.sourceforge.net/geany/?rev=2659&view=rev
Author: eht16
Date: 2008-06-08 05:18:20 -0700 (Sun, 08 Jun 2008)
Log Message:
-----------
Fix two ambiguous encoding names for better compatibility with libiconv (closes #1986134).
Improve the regular expression for detecting encoding cookies to allow more variants (e.g. "encoding: utf-8").
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/encodings.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2008-06-07 11:42:31 UTC (rev 2658)
+++ trunk/ChangeLog 2008-06-08 12:18:20 UTC (rev 2659)
@@ -1,3 +1,12 @@
+2008-06-08 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
+
+ * doc/geany.html, doc/geany.html, src/encodings.c:
+ Fix two ambiguous encoding names for better compatibility with
+ libiconv (closes #1986134).
+ Improve the regular expression for detecting encoding cookies to
+ allow more variants (e.g. "encoding: utf-8").
+
+
2008-06-07 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
* src/prefs.c: Update of a string for adding a missing full stop.
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2008-06-07 11:42:31 UTC (rev 2658)
+++ trunk/doc/geany.html 2008-06-08 12:18:20 UTC (rev 2659)
@@ -804,13 +804,20 @@
characters are around the string " geany_encoding=ISO-8859-15 " as long
as there is at least one whitespace character before and after this
string. Whitespace characters are in this case a space or tab character.
-"geany_encoding" must be in lower-case, the charset string is
-case-independent. There must <strong>not</strong> be any whitespace between
-"geany_encoding", the "=" sign and the charset.
An example to use this could be you have a file with ISO-8859-15
encoding but Geany constantly detects the file encoding as ISO-8859-1.
Then you simply add such a line to the file and Geany will open it
correctly the next time.</p>
+<p>Since Geany 0.15 you can also use lines like:</p>
+<pre class="literal-block">
+# encoding = ISO-8859-15
+</pre>
+<p>or:</p>
+<pre class="literal-block">
+# coding: ISO-8859-15
+</pre>
+<p>The used regular expression to find the encoding string is:
+<tt class="docutils literal"><span class="pre">coding[\t</span> <span class="pre">]*[:=][\t</span> <span class="pre">]*([a-z0-9-]+)[\t</span> <span class="pre">]*</span></tt></p>
<div class="note">
<p class="first admonition-title">Note</p>
<p class="last">These specifications must be in the first 512 bytes of the file.
@@ -4117,7 +4124,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2008-05-28 15:34 UTC.
+Generated on: 2008-06-08 12:16 UTC.
Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2008-06-07 11:42:31 UTC (rev 2658)
+++ trunk/doc/geany.txt 2008-06-08 12:18:20 UTC (rev 2659)
@@ -469,14 +469,22 @@
characters are around the string " geany_encoding=ISO-8859-15 " as long
as there is at least one whitespace character before and after this
string. Whitespace characters are in this case a space or tab character.
-"geany_encoding" must be in lower-case, the charset string is
-case-independent. There must **not** be any whitespace between
-"geany_encoding", the "=" sign and the charset.
An example to use this could be you have a file with ISO-8859-15
encoding but Geany constantly detects the file encoding as ISO-8859-1.
Then you simply add such a line to the file and Geany will open it
correctly the next time.
+Since Geany 0.15 you can also use lines like::
+
+ # encoding = ISO-8859-15
+
+or::
+
+ # coding: ISO-8859-15
+
+The used regular expression to find the encoding string is:
+``coding[\t ]*[:=][\t ]*([a-z0-9-]+)[\t ]*``
+
.. note::
These specifications must be in the first 512 bytes of the file.
Anything after the first 512 bytes will not be recognised.
Modified: trunk/src/encodings.c
===================================================================
--- trunk/src/encodings.c 2008-06-07 11:42:31 UTC (rev 2658)
+++ trunk/src/encodings.c 2008-06-08 12:18:20 UTC (rev 2659)
@@ -51,8 +51,8 @@
# endif
/* <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> */
# define PATTERN_HTMLMETA "<meta[ \t\n\r\f]http-equiv[ \t\n\r\f]*=[ \t\n\r\f]*\"content-type\"[ \t\n\r\f]+content[ \t\n\r\f]*=[ \t\n\r\f]*\"text/x?html;[ \t\n\r\f]*charset=([a-z0-9_-]+)\"[ \t\n\r\f]*/?>"
-/* " geany_encoding=utf-8 " */
-# define PATTERN_GEANY "[\t ]geany_encoding=([a-z0-9-]+)[\t ]"
+/* " geany_encoding=utf-8 " or " coding: utf-8 " */
+# define PATTERN_CODING "coding[\t ]*[:=][\t ]*([a-z0-9-]+)[\t ]*"
/* precompiled regexps */
static regex_t pregs[2];
static gboolean pregs_loaded = FALSE;
@@ -89,17 +89,19 @@
fill(5, EASTEUROPEAN, GEANY_ENCODING_WINDOWS_1250, "WINDOWS-1250", _("Central European"));
fill(6, EASTEUROPEAN, GEANY_ENCODING_IBM_855, "IBM855", _("Cyrillic"));
fill(7, EASTEUROPEAN, GEANY_ENCODING_ISO_8859_5, "ISO-8859-5", _("Cyrillic"));
+ /* ISO-IR-111 not available on Windows */
fill(8, EASTEUROPEAN, GEANY_ENCODING_ISO_IR_111, "ISO-IR-111", _("Cyrillic"));
- fill(9, EASTEUROPEAN, GEANY_ENCODING_KOI8_R, "KOI8R", _("Cyrillic"));
+ fill(9, EASTEUROPEAN, GEANY_ENCODING_KOI8_R, "KOI8-R", _("Cyrillic"));
fill(10, EASTEUROPEAN, GEANY_ENCODING_WINDOWS_1251, "WINDOWS-1251", _("Cyrillic"));
fill(11, EASTEUROPEAN, GEANY_ENCODING_CP_866, "CP866", _("Cyrillic/Russian"));
- fill(12, EASTEUROPEAN, GEANY_ENCODING_KOI8_U, "KOI8U", _("Cyrillic/Ukrainian"));
+ fill(12, EASTEUROPEAN, GEANY_ENCODING_KOI8_U, "KOI8-U", _("Cyrillic/Ukrainian"));
fill(13, EASTEUROPEAN, GEANY_ENCODING_ISO_8859_16, "ISO-8859-16", _("Romanian"));
fill(0, MIDDLEEASTERN, GEANY_ENCODING_IBM_864, "IBM864", _("Arabic"));
fill(1, MIDDLEEASTERN, GEANY_ENCODING_ISO_8859_6, "ISO-8859-6", _("Arabic"));
fill(2, MIDDLEEASTERN, GEANY_ENCODING_WINDOWS_1256, "WINDOWS-1256", _("Arabic"));
fill(3, MIDDLEEASTERN, GEANY_ENCODING_IBM_862, "IBM862", _("Hebrew"));
+ /* not available at all, ? */
fill(4, MIDDLEEASTERN, GEANY_ENCODING_ISO_8859_8_I, "ISO-8859-8-I", _("Hebrew"));
fill(5, MIDDLEEASTERN, GEANY_ENCODING_WINDOWS_1255, "WINDOWS-1255", _("Hebrew"));
fill(6, MIDDLEEASTERN, GEANY_ENCODING_ISO_8859_8, "ISO-8859-8", _("Hebrew Visual"));
@@ -126,6 +128,7 @@
fill(0, EASTASIAN, GEANY_ENCODING_GB18030, "GB18030", _("Chinese Simplified"));
fill(1, EASTASIAN, GEANY_ENCODING_GB2312, "GB2312", _("Chinese Simplified"));
fill(2, EASTASIAN, GEANY_ENCODING_GBK, "GBK", _("Chinese Simplified"));
+ /* maybe not available on Linux */
fill(3, EASTASIAN, GEANY_ENCODING_HZ, "HZ", _("Chinese Simplified"));
fill(4, EASTASIAN, GEANY_ENCODING_BIG5, "BIG5", _("Chinese Traditional"));
fill(5, EASTASIAN, GEANY_ENCODING_BIG5_HKSCS, "BIG5-HKSCS", _("Chinese Traditional"));
@@ -324,7 +327,7 @@
if (! pregs_loaded)
{
regex_compile(&pregs[0], PATTERN_HTMLMETA);
- regex_compile(&pregs[1], PATTERN_GEANY);
+ regex_compile(&pregs[1], PATTERN_CODING);
pregs_loaded = TRUE;
}
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list