Specification of source charset encoding in MSVC++, like gcc “-finput-charset=CharSet”

前端 未结 5 1576
故里飘歌
故里飘歌 2020-12-03 01:30

I want to create some sample programs that deal with encodings, specifically I want to use wide strings like:

wstring a=L\"grüßen\";
wstring b=L\"שלום עולם!\         


        
5条回答
  •  臣服心动
    2020-12-03 02:19

    For VS you can use:

    #pragma setlocale( "[locale-string]" )
    

    The default ANSI code page of the locale will be used as file encoding.

    But in general is a bad idea to hard-code any user-visible strings in your code. Store them in some kind of resources. Good for localization, easy spell-checking and updating, etc.

提交回复
热议问题