久々に技術的な話。 ちょっと、仕事でハマったので、共有&メモっておきます。 Visual Studio の C/C++ で、文字列リテラルがビルド後の実行ファイル内で文字コードが何になるかという話。 まず、文字列リテラルですが printf( "abcdef" ); のようにダブルクォーテーション「"」で囲まれた中身、「abcdef」が文字列リテラルです。 半角アルファベット英数文字ならまったく問題なく、ASCIIコードになります。 問題は全角文字、日本語が入ってきた場合です。 printf( "ほげほげ" ); これを Visual Studio でビルドすると、出来上がった exe の中身は Shift JIS になります。 他の文字コードの選択としては、ワイド文字(UTF-16)があります。 ワイド文字にするには、どうすれば良いかと言いますと。 文字列リテラルの前に接頭辞「L」を付け