Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Why printf() does not care of my locale settings ?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Guilbert STABILO, post: 3891939"] 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: 'Ü' [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Why printf() does not care of my locale settings ?
Top