]> git.ipfire.org Git - thirdparty/xz.git/commit
xzdec: Use setlocale() via tuklib_gettext_setlocale()
authorLasse Collin <lasse.collin@tukaani.org>
Wed, 18 Dec 2024 12:23:13 +0000 (14:23 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Wed, 18 Dec 2024 15:09:30 +0000 (17:09 +0200)
commit78868b6ed63fa4c89f73e3dfed27abfb8b0d46db
tree2a6f0e07c80f68be7bdd2c795baef6b31d002314
parent0d0b574cc45045d6150d397776340c068df59e2a
xzdec: Use setlocale() via tuklib_gettext_setlocale()

xzdec isn't translated and didn't have locale-specific behavior
in the past. On Windows with UTF-8 in the application manifest,
setting the locale makes a difference though:

  - Without any setlocale() call, non-ASCII filenames don't display
    properly in Command Prompt unless one first uses "chcp 65001"
    to set the console code page to UTF-8.

  - setlocale(LC_ALL, "") is enough to make non-ASCII filenames
    print correctly in Command Prompt without using "chcp 65001",
    assuming that the non-UTF-8 code page (like 850) supports
    those non-ASCII characters.

  - setlocale(LC_ALL, ".UTF8") is even better because then mbrtowc() and
    such functions use an UTF-8 locale instead of a legacy code page.
    The tuklib_gettext_setlocale() macro takes care of this (without
    enabling any translations).

Fixes: 46ee0061629fb075d61d83839e14dd193337af59
src/xzdec/xzdec.c