diff options
author | Timo Teräs <timo.teras@iki.fi> | 2015-09-11 09:41:44 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2015-09-11 09:41:44 +0300 |
commit | 963b00043c4d3fa933ed0c3c5d909ac3bb5d0421 (patch) | |
tree | 79a27e7456e94f5d92abb1118420850c886df1d8 /main/musl/0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch | |
parent | 333a16d94df1eddca2b81ea51868a91128505509 (diff) | |
download | aports-963b00043c4d3fa933ed0c3c5d909ac3bb5d0421.tar.bz2 aports-963b00043c4d3fa933ed0c3c5d909ac3bb5d0421.tar.xz |
main/musl: cherry-pick upstream fixes
make previous commits the upstream versions, and add few
additional fixes
Diffstat (limited to 'main/musl/0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch')
-rw-r--r-- | main/musl/0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/main/musl/0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch b/main/musl/0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch new file mode 100644 index 0000000000..2148656679 --- /dev/null +++ b/main/musl/0004-make-nl_langinfo-CODESET-always-return-UTF-8.patch @@ -0,0 +1,46 @@ +From 844212d94f582c4e3c5055e0a1524931e89ebe76 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Wed, 9 Sep 2015 05:13:33 +0000 +Subject: [PATCH] make nl_langinfo(CODESET) always return "UTF-8" + +this restores the original behavior prior to the addition of the +byte-based C locale and fixes what is effectively a regression in +musl's property of always providing working UTF-8 support. + +commit 1507ebf837334e9e07cfab1ca1c2e88449069a80 introduced the codeset +name "UTF-8-CODE-UNITS" for the byte-based C locale to represent that +the semantic content is UTF-8 but that it is being processed as code +units (bytes) rather than whole multibyte characters. however, many +programs assume that the codeset name is usable with iconv and/or +comes from a set of standard/widely-used names known to the +application. such programs are likely to produce warnings or errors, +run with reduced functionality, or mangle character data when run +explicitly in the C locale. + +the standard places basically no requirements for the string returned +by nl_langinfo(CODESET) and how it interacts with other interfaces, so +returning "UTF-8" is permissible. moreover, it seems like the right +thing to do, since the identity of the character encoding as "UTF-8" +is independent of whether it is being processed as bytes of characters +by the standard library functions. +--- + src/locale/langinfo.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c +index 776b447..69693ff 100644 +--- a/src/locale/langinfo.c ++++ b/src/locale/langinfo.c +@@ -33,8 +33,7 @@ char *__nl_langinfo_l(nl_item item, locale_t loc) + int idx = item & 65535; + const char *str; + +- if (item == CODESET) +- return MB_CUR_MAX==1 ? "UTF-8-CODE-UNITS" : "UTF-8"; ++ if (item == CODESET) "UTF-8"; + + switch (cat) { + case LC_NUMERIC: +-- +2.5.1 + |