Norio Ota wrote :
Would you tell me how to display Japanese on the debug console window?
// the content in the quotation mark is actually Japanese.
fprintf ( stderr, "Nihongo string here" ); // it works.
It works because your source file is encoded in UTF8, and the console window expects UTF8 characters.
// the following codes don't work. The string in the quotation is also Japanese.
char * c_str = "Nihongo".
fprintf ( stderr, "%s\n", c_str ); // not work.
I think this code is not in the same file as the previous one. If the file is encoded with UTF8, it should work.
CFStringRef cfRef = CFStringCreateWithCString (NULL, c_str, CFStringGetSystemEncoding());
There's an error here : never use CFStringGetSystemEncoding() in this situation ! Your string is hard coded in the binary, so it has a precise encoding. The user may change the system default encoding, so it will be a chance that he choose the good one.
The good way to do that is to also hardcode the encoding. If your source file is encoded with UTF8, use kCFStringEncodingUTF8.
CFShow (cfRef); // not work
CFShow convert all non-ascii characters to "\uXXXX", so it's not a good choice for such tests. You may use the Cocoa NSLog instead (and link against the Cocoa framework).
CFRelease ( cfRef);