Click here to Skip to main content
15,916,378 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionunicode strings Pin
Waldermort26-Aug-06 5:42
Waldermort26-Aug-06 5:42 
AnswerRe: unicode strings Pin
fefe.wyx26-Aug-06 6:32
fefe.wyx26-Aug-06 6:32 
GeneralRe: unicode strings Pin
Waldermort26-Aug-06 7:06
Waldermort26-Aug-06 7:06 
GeneralRe: unicode strings Pin
Pierre Leclercq26-Aug-06 8:55
Pierre Leclercq26-Aug-06 8:55 
GeneralRe: unicode strings Pin
Waldermort26-Aug-06 9:04
Waldermort26-Aug-06 9:04 
GeneralRe: unicode strings Pin
Pierre Leclercq26-Aug-06 9:49
Pierre Leclercq26-Aug-06 9:49 
GeneralRe: unicode strings Pin
Justin Tay26-Aug-06 10:08
Justin Tay26-Aug-06 10:08 
AnswerRe: unicode strings Pin
Mike Dimmick26-Aug-06 10:51
Mike Dimmick26-Aug-06 10:51 
The behaviour will depend on the codepage that the compiler uses to read the source file, which is the user's default codepage - for a Western developer, that will normally be Windows-1252. Newer versions of the compilers I think can recognise the Byte Order Mark to handle UTF-16 or UTF-8 source code files (the BOM is the character U+FEFF, so if the file begins with the bytes 0xFF 0xFE, it's likely to be a UTF-16 little-endian file, while if it starts 0xEF 0xBB 0xBF, it's probably a UTF-8 file).

In VS2003 and 2005, you can go to File, Advanced Save Options and specify the encoding to use for a given source file.

You may get best results using either a UTF-8 or UTF-16 source file, if your environment supports it, or using the hex escapes to explicitly specify the characters. I'm not sure if Visual C++ supports the '\u' syntax for specifying Unicode characters directly - I don't think it does.

Note that any Latin characters in your MBCS string will be encoded using one byte, not two: indeed, any character coloured white on, for example, this reference chart[^] (Simplified Chinese CP936).

Finally, you're not explicitly encoding the translation of 'Program Files', are you? There are many locations that you can, and should, discover the localized path for using the SHGetSpecialFolderPath API.

Stability. What an interesting concept. -- Chris Maunder

GeneralRe: unicode strings Pin
Waldermort26-Aug-06 11:02
Waldermort26-Aug-06 11:02 
AnswerRe: unicode strings Pin
Michael Dunn26-Aug-06 21:37
sitebuilderMichael Dunn26-Aug-06 21:37 
GeneralRe: unicode strings Pin
Waldermort26-Aug-06 22:19
Waldermort26-Aug-06 22:19 
GeneralRe: unicode strings Pin
Michael Dunn26-Aug-06 22:52
sitebuilderMichael Dunn26-Aug-06 22:52 
QuestionLinked list of strings - how to? Pin
jon-8026-Aug-06 4:22
professionaljon-8026-Aug-06 4:22 
AnswerRe: Linked list of strings - how to? [modified] Pin
Dave Calkins26-Aug-06 5:39
Dave Calkins26-Aug-06 5:39 
GeneralRe: Linked list of strings - how to? Pin
jon-8026-Aug-06 7:32
professionaljon-8026-Aug-06 7:32 
AnswerRe: Linked list of strings - how to? Pin
David Crow28-Aug-06 4:33
David Crow28-Aug-06 4:33 
Questionfloat to string Pin
Waldermort26-Aug-06 3:46
Waldermort26-Aug-06 3:46 
AnswerRe: float to string Pin
Mike Dimmick26-Aug-06 9:25
Mike Dimmick26-Aug-06 9:25 
QuestionHooking up Direct3D... but which one ? Pin
seq-26-Aug-06 3:45
seq-26-Aug-06 3:45 
AnswerRe: Hooking up Direct3D... but which one ? Pin
Andy Moore27-Aug-06 10:14
Andy Moore27-Aug-06 10:14 
GeneralRe: Hooking up Direct3D... but which one ? Pin
seq-27-Aug-06 10:49
seq-27-Aug-06 10:49 
QuestionUsing mouse scroll Pin
xkrja26-Aug-06 2:54
xkrja26-Aug-06 2:54 
AnswerRe: Using mouse scroll Pin
Waldermort27-Aug-06 0:34
Waldermort27-Aug-06 0:34 
QuestionNo default constructor Pin
#realJSOP26-Aug-06 1:25
professional#realJSOP26-Aug-06 1:25 
AnswerRe: No default constructor [modified] Pin
Garth J Lancaster26-Aug-06 1:40
professionalGarth J Lancaster26-Aug-06 1:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.