[Qt-interest] QTextCodec?
nobody
mobody09 at gmail.com
Thu Aug 19 06:37:12 CEST 2010
On 19/08/2010 11:55 AM, 1+1=2 wrote:
> make sure that your qtcodecs plugins has been installed: such as
> qtwcodecs, qcncodecs, qjpcodecs and qkrcodecs. which will in
> %QTDIR%/plugins/codecs.
Hi Debao thanks!
It worked!
Nicely, except the,
QTextCodec * QTextCodec::codecForUtfText ( const QByteArray & ba )
Don't work as expected or I'm missing something else?
Because I am trying to use BOM detection code which can better estimate
dynamically at run-time of which charset the string was encoded from.
In contrast, for instance:
QTextCodec::codecForName( "Big5" );
Or
QTextCodec::codecForUtfText( encodedString, QTextCodec::codecForName(
"Big5" ) );
The above two works.
QTextCodec::codecForUtfText( encodedString );
Doesn't work and it can't find an appropriate codec for the encoding,
however if defaultCodec is specified in the second parameter then it
will work and defaultCodec will top the list of availableCodecs().
Does anyone know, is the detection of encoding type (charset) an
experimental feature or is it unlikely that BOM detection has success
rate of below 50% ?
Can I however set up a preference of order of which codec is used to
research or detect BOM, because I think the detection code works down
the list and then match a working type of codec (this tends to be wrong
as the likely chance is quite low).
Is there a 100% success solution for BOM detect perhaps using another
library such as libiconv which I'm not familiar of ?
>
> Debao
>
> On Thu, Aug 19, 2010 at 8:07 AM, nobody<mobody09 at gmail.com> wrote:
>> On 19/08/2010 2:01 AM, Thiago Macieira wrote:
>>> On Wednesday 18 August 2010 14:47:55 nobody wrote:
>>>> Hi,
>>>> Anyone know if this function will work without libiconv installed on
>>>> win32 QTextCodec::toUnicode() ?
>>>>
>>>> I can't find any configure option using enable iconv with Qt-4.7 beta2
>>>> But this particular function crash at run-time
>>>> QTextCodec::codecForName("supported encodings")
>>>> The returned codec is zero.
>>>
>>> Qt doesn't offer you codecs from libiconv. It uses libiconv only to translate
>>> the Unix locale to UTF-8, so that we don't need to detect which charset the
>>> locale uses.
>> I see so don't have to worry about not having libiconv installed on Windows.
>>>
>>> libiconv is not used on Windows.
>>>
>>> That also means that Qt offers exactly the same codecs on Windows, on Mac and
>>> on Linux, but not on Symbian (on Symbian, we actually do offer the codecs from
>>> the system).
>> I just ran function on Qt 4.7 beta2 on my system and it returns this list.
>> QList<QByteArray> availableCodecs ()
>>
>> UTF-8
>> ISO-8859-1
>> latin1
>> CP819
>> IBM819
>> iso-ir-100
>> csISOLatin1
>> ISO-8859-15
>> latin9
>> UTF-32LE
>> UTF-32BE
>> UTF-32
>> UTF-16LE
>> UTF-16BE
>> UTF-16
>> System
>> roman8
>> hp-roman8
>> csHPRoman8
>> TIS-620
>> ISO 8859-11
>> WINSAMI2
>> WS2
>> Apple Roman
>> macintosh
>> MacRoman
>> windows-1258
>> CP1258
>> windows-1257
>> CP1257
>> windows-1256
>> CP1256
>> windows-1255
>> CP1255
>> windows-1254
>> CP1254
>> windows-1253
>> CP1253
>> windows-1252
>> CP1252
>> windows-1251
>> CP1251
>> windows-1250
>> CP1250
>> IBM866
>> CP866
>> csIBM866
>> IBM874
>> CP874
>> IBM850
>> CP850
>> csPC850Multilingual
>> ISO-8859-16
>> iso-ir-226
>> latin10
>> ISO-8859-14
>> iso-ir-199
>> latin8
>> iso-celtic
>> ISO-8859-13
>> ISO-8859-10
>> iso-ir-157
>> latin6
>> ISO-8859-10:1992
>> csISOLatin6
>> ISO-8859-9
>> iso-ir-148
>> latin5
>> csISOLatin5
>> ISO-8859-8
>> ISO 8859-8-I
>> iso-ir-138
>> hebrew
>> csISOLatinHebrew
>> ISO-8859-7
>> ECMA-118
>> greek
>> iso-ir-126
>> csISOLatinGreek
>> ISO-8859-6
>> ISO-8859-6-I
>> ECMA-114
>> ASMO-708
>> arabic
>> iso-ir-127
>> csISOLatinArabic
>> ISO-8859-5
>> cyrillic
>> iso-ir-144
>> csISOLatinCyrillic
>> ISO-8859-4
>> latin4
>> iso-ir-110
>> csISOLatin4
>> ISO-8859-3
>> latin3
>> iso-ir-109
>> csISOLatin3
>> ISO-8859-2
>> latin2
>> iso-ir-101
>> csISOLatin2
>> KOI8-U
>> KOI8-RU
>> KOI8-R
>> csKOI8R
>> Iscii-Mlm
>> Iscii-Knd
>> Iscii-Tlg
>> Iscii-Tml
>> Iscii-Ori
>> Iscii-Gjr
>> Iscii-Pnj
>> Iscii-Bng
>> Iscii-Dev
>> TSCII
>>
>> As you can see, for example Big5 or CP950 isn't in the list but is in
>> the official qt 4.6 documentations
>> http://doc.qt.nokia.com/4.6/qtextcodec.html under detailed descriptions.
>> If I'm reading correctly. I think none of the Asian countries languages
>> charset are listed as available codecs on my system, why is that ?
>>
More information about the Qt-interest-old
mailing list