Linux standalone: Improve generation of locale definition files, supporting locales such as, en_GB.UTF-8.

This commit is contained in:
Joey Hess 2016-12-19 17:03:52 -04:00
parent df5a0059ca
commit 95c8b37544
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
3 changed files with 24 additions and 1 deletions

View file

@ -17,6 +17,8 @@ git-annex (6.20161211) UNRELEASED; urgency=medium
* p2p: --link no longer takes a remote name, instead the --name
option can be used.
* Debian: Build webapp on armel.
* Linux standalone: Improve generation of locale definition files,
supporting locales such as, en_GB.UTF-8.
-- Joey Hess <id@joeyh.name> Sun, 11 Dec 2016 21:29:51 -0400

View file

@ -0,0 +1,21 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2016-12-19T20:37:56Z"
content="""
JSON uses a UTF-8 encoding. So the usual hack used in git-annex
of bypassing the system locale and essentially reading data as binary can't
work for --json.
So, I think you need to be using a unicode locale, which is properly set up
in order to use --json. And, the data fed in via --json needs to actually
be encoded as unicode and not some other encoding.
runshell was recently changed to bypass using the system locales, it
includes its own locale data and attempts to generate a locale definition
file for the locale. The code that did that was failing to notice that
en_GB.UTF-8 was a UTF-8 locale (en_GB.utf8 would work though), which
explains why the locale is not set inside runshell
(git-annex.linux/git-annex is a script that uses runshell). I've corrected
that problem, and verified it fixes the problem you reported.
"""]]

View file

@ -132,7 +132,7 @@ for localeenv in "$LANG" "$LANGUAGE" "$LC_CTYPE" "$LC_NUMERIC" "$LC_TIME" \
if [ "$localeenv" != "$lastlocaleenv" ]; then
lastlocaleenv="$localeenv"
if [ ! -d "$base/locales/$localeenv" ]; then
if [ "${localeenv##[!.]*.}" = "utf8" ]; then
if [ "${localeenv##[!.]*.}" = "utf8" ] || [ "${localeenv##[!.]*.}" = "UTF-8" ]; then
(
rm -rf "$base/locales/$localeenv.new.$$" &&
mkdir -p "$base/locales/$localeenv.new.$$" &&