G
Guilbert STABILO
Hi all,
I have to manage the internationalization on a C++ application which
has to work with different countries and regions.
I also have to work with ANSI 8-bits characters (no Unicode allowed in
my project).
My first test was to print the 0x9A character using the French code
page (1252) which stands for U-Trema.
Then I changed the page code to Russian (1251) so my printf should
display a Cyrillic U but it still displays a U-Trema.
I also tried to printf all the ANSI characters but the result was the
same in both cases (French then Russian).
=> Did I miss something ?
=> How can I manage so my printf() displays the wanted character from
the wanted code page ?
Thanks in advance for your help.
I built this small code under Windows but I am using standard calls
which work the same under Unix:
#include <locale.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
// 0x9A is U-Trema when using the French 1252 code page.
printf(setlocale(LC_ALL, "french"));
printf(": '%c'\n", 0x9A);
// 0x9A should become cyrillic U when using the Russian 1251 code
page.
printf(setlocale(LC_ALL, "russian"));
printf(": '%c'\n", 0x9A);
return(0);
}
And here is the program output:
French_France.1252: 'Ü'
Russian_Russia.1251: 'Ü'
I have to manage the internationalization on a C++ application which
has to work with different countries and regions.
I also have to work with ANSI 8-bits characters (no Unicode allowed in
my project).
My first test was to print the 0x9A character using the French code
page (1252) which stands for U-Trema.
Then I changed the page code to Russian (1251) so my printf should
display a Cyrillic U but it still displays a U-Trema.
I also tried to printf all the ANSI characters but the result was the
same in both cases (French then Russian).
=> Did I miss something ?
=> How can I manage so my printf() displays the wanted character from
the wanted code page ?
Thanks in advance for your help.
I built this small code under Windows but I am using standard calls
which work the same under Unix:
#include <locale.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
// 0x9A is U-Trema when using the French 1252 code page.
printf(setlocale(LC_ALL, "french"));
printf(": '%c'\n", 0x9A);
// 0x9A should become cyrillic U when using the Russian 1251 code
page.
printf(setlocale(LC_ALL, "russian"));
printf(": '%c'\n", 0x9A);
return(0);
}
And here is the program output:
French_France.1252: 'Ü'
Russian_Russia.1251: 'Ü'