Tools can display gibberish messages from translations
Submitted by Chun-wei Fan
The command-line tools included with GLib built with later versions of Visual Studio (>=2012) displays gibberish when displaying messages that are acquired from the translations. Upon some investigation, it seems that the CRT implementation of setlocale (LC_ALL, "") returns different values:
msvcrt90.DLL: Chinese (Simplified)_Taiwan.950 vcruntime140.DLL: Chinese_Taiwan.936 (vcruntime140.dll is the CRT for Visual Studio 2015--Likewise for msvcr110.dll and msvcr120.dll)
(My system runs on a zh_TW (Chinese (Traditional) locale, code page 950; codepage 936 refers to the codepage used in Mainland China, i.e. zh_CN, Simplified Chinese).
This is obviously a CRT issue on Microsoft's side, but would affect users using translations in command-line tool programs (but interestingly, GUI programs are not affected by this issue).
To fix the issues, we need to call setlocale (LC_ALL, ".ACP") in these tools to make use of the current code page correctly, in which setlocale (LC_ALL, "") was intended to do initially, according to the MSDN docs for setlocale().
I will attach patches later for this.
With blessings, thank you!