author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | |
Thu, 12 Aug 2010 22:08:15 +0000 (22:08 +0000) | ||
committer | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | |
Sat, 30 Oct 2010 07:10:05 +0000 (07:10 +0000) | ||
commit | 44405738a05267a479f01f3b29a0a3b33cb15053 | |
tree | 00752e20ba77a801eb38a912cfad82850d7d4370 | tree | snapshot |
parent | ef187c392d925951f8a5f828f62c300641e0cd4f | commit | diff |
gettext: setlocale(LC_CTYPE, "") breaks Git's C function assumptions
Remove the setlocale/LC_CTYPE call from gettext.c, we only need
setlocale/LC_MESSAGES to use the message catalog, and setting LC_CTYPE
from the environment breaks Git's assumptions about C library
functions.
Under a non-C locale functions like vsnprintf become locale sensitive,
so that they'll e.g. refuse to process ISO-8895-1 data under a UTF-8
locale.
This triggered a "your vsnprintf is broken" error on Git's own
repository when inspecting v0.99.6~1 under a UTF-8 locale.
That commit contains a ISO-8859-1 encoded author name, which the
locale aware vsnprintf(3) won't interpolate in the format argument,
due to mismatch between the data encoding and the locale.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Remove the setlocale/LC_CTYPE call from gettext.c, we only need
setlocale/LC_MESSAGES to use the message catalog, and setting LC_CTYPE
from the environment breaks Git's assumptions about C library
functions.
Under a non-C locale functions like vsnprintf become locale sensitive,
so that they'll e.g. refuse to process ISO-8895-1 data under a UTF-8
locale.
This triggered a "your vsnprintf is broken" error on Git's own
repository when inspecting v0.99.6~1 under a UTF-8 locale.
That commit contains a ISO-8859-1 encoded author name, which the
locale aware vsnprintf(3) won't interpolate in the format argument,
due to mismatch between the data encoding and the locale.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gettext.c | diff | blob | history | |
t/t0203-gettext-setlocale-sanity.sh | [new file with mode: 0755] | blob |