mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Bug 681685: Transcoding fails on OSX
Add aliases for codesets supported by iconv and included in locales. Ifdef-out tests in glib/tests/gdatetime.c which fail because on OSX only ASCII numbers or symbols are returned for the format. Even though nl_langinfo does weird things on Darwin in some cases, it still acts correctly when LANG/LC_ALL is set to a supported locale.codeset.
This commit is contained in:
parent
ee8080cc0b
commit
1f005d9385
@ -467,6 +467,38 @@ case "$os" in
|
||||
# minimize the use of decomposed Unicode. Unfortunately, through the
|
||||
# Darwin file system, decomposed UTF-8 strings are leaked into user
|
||||
# space nevertheless.
|
||||
#
|
||||
# Even with those limitations, nl_langinfo does work often
|
||||
# enough to be useful. Since setenv works only with locales
|
||||
# provided in /usr/share/locale, the following aliases are the
|
||||
# codesets used there.
|
||||
echo "ARMSCII-8 ARMSCII-8"
|
||||
echo "Big5HKSCS BIG5-HKSCS"
|
||||
echo "Big5 BIG5"
|
||||
echo "CP866 CP866"
|
||||
echo "CP949 CP949"
|
||||
echo "CP1131 CP1131"
|
||||
echo "CP1251 CP1251"
|
||||
echo "eucCN EUC-CN"
|
||||
echo "eucKR EUC-KR"
|
||||
echo "eucJP EUC-JP"
|
||||
echo "eucjp EUC-JP"
|
||||
echo "GB18030 GB18030"
|
||||
echo "GB2312 GB2312"
|
||||
echo "GBK GBK"
|
||||
# echo "ISCII-DEV ISCII_DEV" Not supported by iconv
|
||||
echo "ISO8859-1 ISO-8859-1"
|
||||
echo "ISO8859-2 ISO-8859-2"
|
||||
echo "ISO8859-4 ISO-8859-4"
|
||||
echo "ISO8859-5 ISO-8859-5"
|
||||
echo "ISO8859-7 ISO-8859-7"
|
||||
echo "ISO8859-9 ISO-8859-9"
|
||||
echo "ISO8859-13 ISO-8859-13"
|
||||
echo "ISO8859-15 ISO-8859-15"
|
||||
echo "KOI8-R KOI8-R"
|
||||
echo "KOI8-U KOI8-U"
|
||||
echo "PT154 CP154"
|
||||
echo "SJIS SHIFT_JIS"
|
||||
echo "* UTF-8"
|
||||
;;
|
||||
beos*)
|
||||
|
@ -901,12 +901,16 @@ test_non_utf8_printf (void)
|
||||
*/
|
||||
TEST_PRINTF ("%a", "\345\234\237");
|
||||
TEST_PRINTF ("%A", "\345\234\237\346\233\234\346\227\245");
|
||||
#ifndef HAVE_CARBON /* OSX just returns the number */
|
||||
TEST_PRINTF ("%b", "10\346\234\210");
|
||||
#endif
|
||||
TEST_PRINTF ("%B", "10\346\234\210");
|
||||
TEST_PRINTF ("%d", "24");
|
||||
TEST_PRINTF_DATE (2009, 1, 1, "%d", "01");
|
||||
TEST_PRINTF ("%e", "24"); // fixme
|
||||
#ifndef HAVE_CARBON /* OSX just returns the number */
|
||||
TEST_PRINTF ("%h", "10\346\234\210");
|
||||
#endif
|
||||
TEST_PRINTF ("%H", "00");
|
||||
TEST_PRINTF_TIME (15, 0, 0, "%H", "15");
|
||||
TEST_PRINTF ("%I", "12");
|
||||
@ -921,18 +925,22 @@ test_non_utf8_printf (void)
|
||||
TEST_PRINTF_TIME (10, 13, 13, "%l", "10");
|
||||
TEST_PRINTF ("%m", "10");
|
||||
TEST_PRINTF ("%M", "00");
|
||||
#ifndef HAVE_CARBON /* OSX returns latin "AM", not japanese */
|
||||
TEST_PRINTF ("%p", "\345\215\210\345\211\215");
|
||||
TEST_PRINTF_TIME (13, 13, 13, "%p", "\345\215\210\345\276\214");
|
||||
TEST_PRINTF ("%P", "\345\215\210\345\211\215");
|
||||
TEST_PRINTF_TIME (13, 13, 13, "%P", "\345\215\210\345\276\214");
|
||||
TEST_PRINTF ("%r", "\345\215\210\345\211\21512\346\231\20200\345\210\20600\347\247\222");
|
||||
TEST_PRINTF_TIME (13, 13, 13, "%r", "\345\215\210\345\276\21401\346\231\20213\345\210\20613\347\247\222");
|
||||
#endif
|
||||
TEST_PRINTF ("%R", "00:00");
|
||||
TEST_PRINTF_TIME (13, 13, 31, "%R", "13:13");
|
||||
TEST_PRINTF ("%S", "00");
|
||||
TEST_PRINTF ("%t", " ");
|
||||
TEST_PRINTF ("%u", "6");
|
||||
#ifndef HAVE_CARBON /* OSX returns YYYY/MM/DD in ASCII */
|
||||
TEST_PRINTF ("%x", "2009\345\271\26410\346\234\21024\346\227\245");
|
||||
#endif
|
||||
TEST_PRINTF ("%X", "00\346\231\20200\345\210\20600\347\247\222");
|
||||
TEST_PRINTF_TIME (13, 14, 15, "%X", "13\346\231\20214\345\210\20615\347\247\222");
|
||||
TEST_PRINTF ("%y", "09");
|
||||
|
Loading…
Reference in New Issue
Block a user