OK, first thing first, a pagecode is actually a codepage and a local is actually a locale.
Originally Posted by Jumper
Yes, that is pretty much correct. Consider the value 156. Using the 1252 (ansi Latin 1) codepage this value may map to one character while using the 50936 (simplified Chinese) codepage it will likely map to a totally different character.
my current understanding is that wide-character/multi-byte characters
are schemas for storing character codes and pagecode
maps some specific code to character glyph(font entry)...
Unicode aims to be a universal character set that contains characters for every script. Therefore it is not dependent on codepages. The value 156 maps to the same character wheter your computer is set up for Chinese or Portugese.
A locale holds various language and format settings. For example consider we want today's date in short format.
If we pass a US locale to GetDateFormat() we will get:
However, if we pass a UK locale to GetDateFormat() we will get:
You can see the Locale Information page for more details on what a windows locale can control.
A locale may also hold details on the currently used codepage. As well as Windows locales there is also C locales.
As mentioned previously, unicode can handle characters for every language (although you may not have appropriate fonts installed). If not using unicode, you can only use characters available in the current code page.
say, i have a text-based control and documentation says that it uses a local to output text OR it uses some pagecode for symbol translation...
so if i want to print each line of text in different language how is that possible?
which win32 objects are depend on pagecode and/or local and is this means that these object are limited to simultenouesly handling only 3 or 2 types of glyphes(languages)?
You're making this way too complex.
i want to write a program that reads a unicode file with a few line in different language, say UTF-8.
now, i know that there are routines which are local based
and unicode based
as i see it, if i use a locale aware
routine then the file won't be read properly because the local
translates character codes according to some pagecode(global?)
and it will be mapped to wrong glyphs... so i must use general unicode i/o functions...
so what are local dependant
function good for?
- Read the UTF-8 into a LPSTR.
- Convert to unicode using MultiByteToWideChar(CP_UTF8, ...);
- Use the resulting unicode string.
Sample code to add a UTF8 string to a list box.
Note: Windows 95/98/ME does not support unicode so, on those platforms, you are stuck with using characters from the current code page or having to use owner drawn.
void AddUTF8ToListBox(HWND hwndListBox, LPCSTR szUTF8)
if (0 != MultiByteToWideChar(CP_UTF8, 0, szUTF8, -1, szW, 1024))
SendMessageW(hwndListBox, LB_ADDSTRING, 0, (LPARAM) szW);