From: Michihiro NAKAJIMA Date: Tue, 17 May 2011 10:49:00 +0000 (-0400) Subject: It seems Mac OS cannot convert U+1109A, U+1109C and U+110AB to NFD although that... X-Git-Tag: v3.0.0a~330 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d3fbcc1dfd3720acc8f23b769fc1f48228bbe4a5;p=thirdparty%2Flibarchive.git It seems Mac OS cannot convert U+1109A, U+1109C and U+110AB to NFD although that is undocumented as far as I know. SVN-Revision: 3357 --- diff --git a/libarchive/test/test_archive_string_conversion.c b/libarchive/test/test_archive_string_conversion.c index 007892759..27f889f00 100644 --- a/libarchive/test/test_archive_string_conversion.c +++ b/libarchive/test/test_archive_string_conversion.c @@ -71,6 +71,11 @@ unicode_to_utf8(char *p, uint32_t uc) return ((int)(p - _p)); } +/* + * Note: U+2000 - U+2FFF, U+F900 - U+FAFF and U+2F800 - U+2FAFF are not + * converted to NFD on Mac OS. + * see also http://developer.apple.com/library/mac/#qa/qa2001/qa1173.html + */ static int scan_unicode_pattern(char *out, const char *pattern, int exclude_mac_nfd) { @@ -85,11 +90,25 @@ scan_unicode_pattern(char *out, const char *pattern, int exclude_mac_nfd) uc = (uc << 4) + (*p - 'A' + 0x0a); else { if (exclude_mac_nfd) { - /* These are not converted to NFD on Mac OS. */ + /* + * These are not converted to NFD on Mac OS. + */ if ((uc >= 0x2000 && uc <= 0x2FFF) || (uc >= 0xF900 && uc <= 0xFAFF) || (uc >= 0x2F800 && uc <= 0x2FAFF)) return (-1); + /* + * Those code points are not converted to + * NFD on Mac OS. I do not know the reason + * because it is undocumented. + * NFC NFD + * 1109A ==> 11099 110BA + * 1109C ==> 1109B 110BA + * 110AB ==> 110A5 110BA + */ + if (uc == 0x1109A || uc == 0x1109C || + uc == 0x110AB) + return (-1); } op += unicode_to_utf8(op, uc); if (!*p) {