1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Windows の GetCommandLineA で UTF-8 は来るのかどうか

Posted at

結論的には、来ません(でした)。

Unicode 対応ではないプログラムの言語 (システムロケール) 英語表示だと Language for non-Unicode programs (System Locale) の選択に依存すると確信いたします。

image.png

参考: 情報: システムのロケールとユーザー ロケールの違い

The system locale determines which code pages (ANSI, MS-DOS, and Macintosh) are used on the system by default. Changing the system locale also installs the necessary bitmap font files to support applications in the language you selected. This is a per-system setting, and requires that you restart your computer (reboot) to change the setting. You can select a system locale only if the appropriate language group is installed; for example, you can't change the system locale to Chinese if your operating system is English Windows NT with no Chinese support.

検証方法

DumpCmdline のソースコード https://github.com/HiraokaHyperTools/DumpCmdline

Windows 10 Pro (x64) バージョン 1809 日本語版

コマンドライン

DumpCmdline.exe 123あいうえお🍷
文字 GetCommandLineA
Shift_JIS
GetCommandLineW
UTF-16
1 31 0031
2 32 0032
3 31 0033
82 A0 3042
82 A2 3044
82 A4 3046
82 A6 3048
82 A8 304A
🍷 3F 3F D83C DF77

Windows コマンドプロンプトにて

コードページ 932 (ANSI/OEM - 日本語 Shift-JIS) で

image.png

コードページ 437 (OEM - 米国) で

image.png

MinGW 2.6.0 bash にて

image.png

Cygwin 3.0.4 bash にて

image.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?