I18N FAQ on Visual C++

I18N FAQ on Visual C++


Where can I find a good referance for i18n support in VC++ ?
I enabled my code for Unicode. But my linker cannot find the Unicode version of the standard libraries. Why ?
I am reading a Unicode file Using fgetws(). But I get null embedded strings. why?
rich edit control is displayed question mark when enter Chinese characters ?
Is there an automation tool to syncronize Localized RC file with English RC files ?

Where can I find a good referance for i18n support in VC++ ?

Where else... http://msdn.microsoft.com

I enabled my code for Unicode. But my linker cannot find the Unicode version of the standard libraries. Why ?

Unicode libararies are not installed by default when you install VC++. Go to custom install and explicitly "check" the unicode libraires checkbox.

I am reading a Unicode file Using fgetws(). But I get null embedded strings. why?

For reading Unicode string in VC++ you should open the file in binary mode. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_unicode.99_.stream_i.2f.o_in_text_and_binary_modes.asp for details.
This applies to any stream I/O routine such as fwprintf, fwscanf, fgetwc, fputwc, fgetws, or fputws.

rich edit control is displayed question mark when enter Chinese characters ?

Problem:
I have a rich edit control in which am entering chinese character.I Am using GetDlgItemText() to retrieve the characters from rich edit control in avariable of type CString, but the variable doesntshow the chinese character. Instead "???" is displayed. Does anybody have any idea about the
problem?

he internals of rich edit control uses Unicode. But when you call GetDlgItemText() and your code is not Unicode then it will try to convert the Unicode to the current codepage of the process. In your case I think it is trying to convert from UNICODE to ASCII (or CP1252 (Latin)) and hence it turns all the Chinese Unicode char's to question mark.

The solution is to make sure you have /D_UNICODE in your compiler defines. Defining this will make rest of your code handle Unicode as well. (Assuming you used TCHAR everwhere). If you have never used this flag and you have a big code-base this cound be a tedious task, fixing all the compiler errors. But worth it if you have support multiple languages.

The other option is to initialize your current code page to Chinese so when it does the conversion it can still recognize the characters. See the definition of macro's like W2A() A2W() or win32 API's like WideCharToMultiByte() MultiByteToWideChar() to convert Unicode to multi-byte without turning them into question mark. You need to pass the appropriate code page.

Is there an automation tool to syncronize Localized RC file with English RC files ?

Try this tool at
http://www.codeproject.com/tools/LocalizeRC.asp

Also many commercial translation software recognize
.rc file and create localized version automatically.

Since editing an .rc file is very simple inside dev
studio, it is expected of the developers to propagate
the changes from domestic .rc files to the localized
.rc file. All he have to do is open two windows
(resource editors) and copy paste the new
buttons/labels/strings etc to the other window. He can
leave them as English and the translators will pick up
the localized .rc file and translate the delta.

There use to be buggy tool in the earlier version of
vc++ SDK that sync localized .res files called RLMAN. I think microsoft
droped support for that tool. It is
not available anymore.