Re: Qt4 and system locale
Sorry, already did it under win. Will try under Linux at home.
Re: Qt4 and system locale
Quote:
Originally Posted by L.Marvell
Also there is QLocale class that has country(), language() and name() methods in Qt4. But there is no locale().
QLocale::name() looks promising:
Quote:
QString QLocale::name () const
Returns the language and country of this locale as a string of the form "language_country", where language is a lowercase, two-letter ISO 639 language code, and country is an uppercase, two-letter ISO 3166 country code.
See also language() and country().
Quote:
Originally Posted by L.Marvell
but locale is koi8-u.
IMO that's the encoding, not locale.
Re: Qt4 and system locale
Yes, exactly QLocale::name() helped. I had to look through examples before post question. :o
Re: Qt4 and system locale
Hi, all!
I have similar problem in qt4 under win.
I want to get system encoding.
So I do:
variable name contain value "System". But I want to get value "cp1251" or "koi8-r" or something else depending of value current local encoding... Value "System" is not informatively.
Anybody know how to get name of current system encoding?
Re: Qt4 and system locale
Quote:
Originally Posted by
Sergey
Anybody know how to get name of current system encoding?
Have you tried QTextCodec::aliases()?
Re: Qt4 and system locale
Re: Qt4 and system locale
Then maybe if you use QTextCodec::mibEnum() first and then get a new codec using QTextCodec::codecForMib() it will have a proper name?
Re: Qt4 and system locale
I wrote next code:
Code:
int mib = localCodec->mibEnum();
variable n contain value "System"...
Maybe this is a bug in QTextCodec?
Re: Qt4 and system locale
Quote:
Originally Posted by
Sergey
Maybe this is a bug in QTextCodec?
I think that rather OS doesn't specify what encoding it uses currently.