user1989504
user1989504

Reputation: 143

Can Code page and locale differ?

On Windows 7 (64 bit) I set Japan as the locale. On command prompt following is reflected: LC_ALL: English_United States.1252 LC_CTYPE: English_United States.1252 chcp command: Active Code Page: 932 (which is Japanese)

My question is while converting wchar_t* to char* using ICU library what should be default converter used? In this case "US-ASCII" is used and I am getting garbage result in char*. Input: wchar_t* contains Japanese characters

Upvotes: 0

Views: 229

Answers (1)

NuSkooler
NuSkooler

Reputation: 5525

From the ICU documentation:

Depending on system design, setup and APIs, it may not always be possible to find a default codepage that fully works as expected...

If you have means of detecting a default codepage name that are more appropriate for your application, then you should set that name with ucnv_setDefaultName() as the first ICU function call. This makes sure that the internally cached default converter will be instantiated from your preferred name.

Upvotes: 1

Related Questions