Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jan 2017 15:35:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        office@FreeBSD.org
Subject:   [Bug 216372] [patch] devel/icu: turn on same workaround as for Linux to fix incorrect detection UTF-8 locale in some applications
Message-ID:  <bug-216372-25061@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D216372

            Bug ID: 216372
           Summary: [patch] devel/icu: turn on same workaround as for
                    Linux to fix incorrect detection UTF-8 locale in some
                    applications
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: office@FreeBSD.org
          Reporter: vvd@unislabs.com
             Flags: maintainer-feedback?(office@FreeBSD.org)
          Assignee: office@FreeBSD.org
          Keywords: patch

For example net-im/qTox and gwenview5.

More information is here:
http://bugs.icu-project.org/trac/ticket/12886
https://bugreports.qt.io/browse/QTBUG-57522
https://github.com/qTox/qTox/issues/4012#issuecomment-273962027

This patch was tested for net-im/qTox:

--- common/putil.cpp.orig   2016-10-19 17:20:56 UTC
+++ common/putil.cpp
@@ -1813,6 +1813,31 @@
         /* Remap CP949 to a similar codepage to avoid issues with backslash
and won symbol. */
         name =3D "EUC-KR";
     }
+    if (locale !=3D NULL && uprv_strcmp(name, "euc") =3D=3D 0) {
+        /* Linux underspecifies the "EUC" name. */
+        if (uprv_strcmp(locale, "korean") =3D=3D 0) {
+            name =3D "EUC-KR";
+        }
+        else if (uprv_strcmp(locale, "japanese") =3D=3D 0) {
+            /* See comment below about eucJP */
+            name =3D "eucjis";
+        }
+    }
+    else if (uprv_strcmp(name, "eucjp") =3D=3D 0) {
+        /*
+        ibm-1350 is the best match, but unavailable.
+        ibm-954 is mostly a superset of ibm-1350.
+        ibm-33722 is the default for eucJP (similar to Windows).
+        */
+        name =3D "eucjis";
+    }
+    else if (locale !=3D NULL && uprv_strcmp(locale, "en_US_POSIX") !=3D 0=
 &&
+            (uprv_strcmp(name, "ANSI_X3.4-1968") =3D=3D 0 || uprv_strcmp(n=
ame,
"US-ASCII") =3D=3D 0)) {
+        /*
+         * For non C/POSIX locale, default the code page to UTF-8 instead =
of
US-ASCII.
+         */
+        name =3D "UTF-8";
+    }
 #elif U_PLATFORM =3D=3D U_PF_HPUX
     if (locale !=3D NULL && uprv_strcmp(locale, "zh_HK") =3D=3D 0 &&
uprv_strcmp(name, "big5") =3D=3D 0) {
         /* HP decided to extend big5 as hkbig5 even though it's not compat=
ible
:-( */
@@ -1942,7 +1967,7 @@
        nl_langinfo may use the same buffer as setlocale. */
     {
         const char *codeset =3D nl_langinfo(U_NL_LANGINFO_CODESET);
-#if U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED
+#if U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM =
=3D=3D
U_PF_BSD
         /*
          * On Linux and MacOSX, ensure that default codepage for non C/POS=
IX
locale is UTF-8
          * instead of ASCII.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-216372-25061>