Paul J. Lucas has proposed merging lp:~paul-lucas/zorba/bug-942808 into 
lp:zorba.

Requested reviews:
  Paul J. Lucas (paul-lucas)
  Matthias Brantner (matthias-brantner)
Related bugs:
  Bug #942808 in Zorba: "ICU streambuf doesn't, in fact, equate ASCII to 
US-ASCII"
  https://bugs.launchpad.net/zorba/+bug/942808

For more details, see:
https://code.launchpad.net/~paul-lucas/zorba/bug-942808/+merge/95027

Fixed bug 942808.
-- 
https://code.launchpad.net/~paul-lucas/zorba/bug-942808/+merge/95027
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/util/icu_streambuf.cpp'
--- src/util/icu_streambuf.cpp	2012-02-20 18:12:06 +0000
+++ src/util/icu_streambuf.cpp	2012-02-28 19:36:18 +0000
@@ -100,13 +100,19 @@
   return conv;
 }
 
-bool icu_streambuf::is_necessary( char const *charset ) {
-  //
-  // Checking for "US-ASCII" explicitly isn't necessary since ICU knows about
-  // aliases.
-  //
-  return  ucnv_compareNames( charset, "ASCII" )
-      &&  ucnv_compareNames( charset, "UTF-8" );
+bool icu_streambuf::is_necessary( char const *cc_charset ) {
+  //
+  // Apparently, ucnv_compareNames() doesn't consider "US-ASCII" an alias for
+  // "ASCII", so check for "US-ASCII" ourselves.
+  //
+  zstring charset( cc_charset );
+  ascii::trim_whitespace( charset );
+  ascii::to_upper( charset );
+  if ( charset == "US-ASCII" )
+    cc_charset += 3; // skip "US-"
+
+  return  ucnv_compareNames( cc_charset, "ASCII" )
+      &&  ucnv_compareNames( cc_charset, "UTF-8" );
 }
 
 bool icu_streambuf::is_supported( char const *charset ) {

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to