use C locale for LC_CTYPE

"corvid" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <20111021052949.GE11026@local>
If you've been following along on fltk.general, you'll know we've been
in discussion over some unpleasantness regarding Turkic locales and
strcasecmp/toupper/tolower where 'i' and 'I' are different letters.

( http://en.wikipedia.org/wiki/Dotted_and_dotless_I )

The typical solution is to make sort of ASCIIfied versions where you
force i<->I.

I think that, for our purposes, we can just use the ordinary POSIX locale
and save ourselves the trouble.

To see this behaviour:
 export LC_ALL=tr_TR
and then look at:
 <span style="font-size: 0.5IN">these letters should be big</span>
 <p>
 <I>This text should be italic</I>

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
C_locale.diff (text/plain, 1.2 KB)
diff -r e82663b3c477 dw/findtext.cc
--- a/dw/findtext.cc	Thu Oct 20 00:13:55 2011 +0000
+++ b/dw/findtext.cc	Fri Oct 21 05:07:48 2011 +0000
@@ -216,6 +216,10 @@
       return false;
 }
 
+/** \todo If this is made UTF8-aware one day, we might want to
+ * setlocale(LC_CTYPE, "") for the duration of the search. See the comment in
+ * main() for why we normally keep it set to "C".
+ */
 bool FindtextState::search0 (bool backwards,  bool firstTrial)
 {
    if (iterator->getChar () == CharIterator::END)
diff -r e82663b3c477 src/dillo.cc
--- a/src/dillo.cc	Thu Oct 20 00:13:55 2011 +0000
+++ b/src/dillo.cc	Fri Oct 21 05:07:48 2011 +0000
@@ -321,6 +321,16 @@
    }
    dFree(opt_argv);
 
+
+   /* On X, the first fl_open_display() sets the LC_CTYPE aspect of the locale
+    * from the environment, so let's trigger it ourselves so that we can
+    * deal with this. For our purposes, this is very bad in Turkic locales
+    * where 'i' and 'I' are different letters, and strcasecmp(), toupper(),
+    * tolower() no longer work as expected. So we reset it to the C locale.
+    */
+   fl_open_display();
+   setlocale(LC_CTYPE, "C");
+
    // set the default values for the preferences
    a_Prefs_init();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.