about CP_UTF8 macro on Windows/Linux
Hello everyone,
There is a macro CP_UTF8 defined on Windows platform. I am wondering what is the related macro on Linux platform and which header file should I include if I want to use this macro. thanks in advance, George |
To what value is this macro defined?
|
Hi addy86,
Quote:
http://msdn.microsoft.com/library/de...l/nls_0ctr.asp regards, George |
As I understand that page, CP_UTF8 is a value that the variable CodePage can take, and not a macro.
|
What are you trying to achieve? I.e. what do you need this macro for (since there will hardly be a GetCPInfo function on Linux).
|
Thanks jschiwal,
Quote:
regards, George |
Thanks addy86,
Quote:
regards, George |
Hi -
I was going to respond to this a few days ago, but I thought you would have had things squared away by now. For whatever it's worth, here's my $0.02: 1. The fix is probably something like this: http://www.nanobit.net/putty/doxy/PUTTY_8H-source.html Code:
/* You can find more about UTF here: http://www.unicode.org/faq/utf_bom.html http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 http://en.wikipedia.org/wiki/UTF-8 3. "Classic" Unix (including most parts of the standard C and C++ runtime libraries in current versions of Linux) and "classic" Win16 (including the Win9x OS and the default output from most Visual Studio C++ compilers) have native 8-bit text. Java, .Net (and the Windows NT/win2k/XP kernel) have native Unicode (typically 16-bit) text. "Code pages" were basically a Win9x workaround for dealing with Unicode text in an 8-bit environment. They're an 8-bit, Microsoft-specific thing. They're part of "MSLU", the "Microsoft Layer for Unicode": http://msdn.microsoft.com/library/de...or_unicode.asp http://msdn.microsoft.com/library/de...nalization.asp Things are done differently now in Microsoft .Net: http://msdn.microsoft.com/msdnmag/is.../03/bugslayer/ Soooooooo..... 4. The real answer depends on exactly what program you're trying to port. In general, you can probably do something like the macro "Putty" uses above. If that doesn't work for you please, let us know what package you are trying to port (give us a link to the project, if possible). 'Hope that helps .. PSM |
Thanks paulsm4!
Quote:
I have a question, what means "65001" in PUTTY's source codes? regards, George |
Hi, George2 -
That "65001" in "#define CP_UTF8 65001" is ... you guessed it! A "Code Page" ID! Specifically, the code page ID for UTF-8. Here are two more links (in addition to the ones I already posted): http://en.wikipedia.org/wiki/Code_page http://en.wikipedia.org/wiki/Code_page_65001 Please keep in mind: "Code Pages" are limited to 8-bit characters; they are *not* the way you should be doing internationalization for any new code on any contemporary platform. You should be using Unicode: which is fully supported by Unix and Windows; by C, C++, Java, C# and most other popular languages. |
All times are GMT -5. The time now is 01:47 AM. |