>>
how am i supposed to do that ? i mean how should i use this WriteConsoleW()
The online reference for Windows API's/SDK's is MSDN:
http://msdn.microsoft.com/en-us/library/ms687401.aspx You use
GetStdHandle() to get the first parameter for WriteConsoleW().
>>
ive heard that if i can change the default font of console i may be able to gain multilingualism! ist it true ? and if so how to do that !
The font used by the console (cmd.exe) needs to support Unicode. "Raster Fonts" does not support Unicode, "Lucida Console" does.
http://commandwindows.com/configure.htm
>>
didnt work!? did i miss any thing ? !!
As I mentioned in my previous post, wcout and wfstream both perform a wchar_t to char conversion before output.
Here are some things you need to be aware of if you want to write Unicode-aware code and make cross-platform.
Unicode
Part of the Unicode standard is to provide a mapping of character glyphs to a unique integer value. At present, you need at lease a 32bit integer to contain the largest Unicode character value.
When writing source code to deal with Unicode, you need to be aware of how the Unicode characters are encoded. There are several encoding schemes including: UTF8, UTF16LE, UTF16BE, UTF32LE, UTF32BE. The LE and BE versions stand for little-endian/big-endian.
wchar_t
This is the character type used by the standard for doing wide stuff. The standard doesn't require that all implementations make wchar_t a particular size. Which also means that wide string litterals (wich map to wchar_t's) are also implementation defined.
Windows compilers use 16bit wchar_t's and encode wide string literals using UTF16LE.
GCC on *nix uses 32bit wchar_t's and encodes wide string literals using UTF32. The architecture determines if it's LE or BE.
>>
wchar_t s[] = L"چشم";
There are a few problems with doing something like this. First, you need to make sure your compiler even supports the compilation of source files saved as Unicode. Most modern ones do. VC 6.0 does not. Next you have to make sure your editor saves the file in some Unicode format (that the compiler supports).
>>
char c[] = "چشم";
This shouldn't even compile. If it does, then the editor saved the file as ASCII and the character values within the c array are meaningless.
So as you can see, there are many things to consider if you truly hope to write cross-platform code that handles Unicode encodings.
gg