help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to use 'UCS-2' encoding in g++?


From: Dancefire
Subject: How to use 'UCS-2' encoding in g++?
Date: 29 Apr 2007 01:03:03 -0700
User-agent: G2/1.0

I try to use UCS-2LE encoding in my c++ program. But how to specify
the locale string for UCS-2LE? I tried following locale string in my g+
+ test program:

"zh_CN.UCS-2"
"zh_CN.UCS-2LE"
"zh_CN.UCS2"

but none of them work, all of them through a runtime exception for
invalid locale name.

I tried 'locale -a' to list all locale in my system. The above string
didn't exist in the list. However, I found "UCS-2, UCS-2LE.." in
"iconv -l", which is the list of all charset I can use libiconv to
convert from and to.

So, now I have 3 questions:

1. How to use "UCS-2LE" encoding in G++ program with the 'std::locale'
favor, such as we can use mbstowcs() to do the convertion by set
'std::locale::global(loc)'?

2. How to list all valid locale string in 'std::locale'? Are same to
'locale -l'?

3. What and Why the difference of support for encoding between g++'s
"std::locale" and libiconv?

Cheers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]