[Qt-interest] QTextCodec?

nobody mobody09 at gmail.com
Thu Aug 19 01:56:04 CEST 2010


On 18/08/2010 11:15 PM, Andre Somers wrote:
>    Op 18-8-2010 15:06, nobody schreef:
>> On 18/08/2010 10:59 PM, Andre Somers wrote:
>>>      Op 18-8-2010 14:47, nobody schreef:
>>>> 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.
>>> Are you sure there is a codec with the name "supported encodings" then?
>> Yeah of course it is directly written on the qt4 documentations web page.
>> Right under the title "Detailed Description"
>> http://doc.qt.nokia.com/4.6/qtextcodec.html
> I guess I'm blind then; I don't see a codec listed there with the name
> "supported encodings".
The point is that I used "one of the supported encodings as the 
parameter" and the function still return zero.
>>> Is that in the list you get from QTextCodec::availableCodecs()? Anyway,
>>> you should never assume that the pointer you get back from a
>>> function like this is valid. Check before derefencing!
Yeah you're correct. The fact that I was in a hurry and neglected to 
check it which I automatically assume that it should be supported and I 
should get something else then 0 and I trusted the documentations page.
In fact what I assume isn't true.
Here is the return of list, QT 4.7 Beta 2:
( availableCodecs() on my System )
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

>> All I can tell is that toUnicode() crashed... For some odd reasons..
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 10168.0x1164]
>> 0x0000000002e0870b in ZNK10QTextCodec9toUnicodeERK10QByteArray ()
> Question is still: did you check that
Yes I didn't check that which is why it crashed ...
>
> QTextCodec::codecForName("supported encodings")
>
> does not return 0?
No, it returns 0 for instance Big5 and GB18030-0 and Shift-JIS and a lot 
more supported codec described in the 
http://doc.qt.nokia.com/4.6/qtextcodec.html

Therefore, I can see supported encodings listed in 
http://doc.qt.nokia.com/4.6/qtextcodec.html and the available encodings 
on my system mismatch and are missing some of it described in the doc.
Let me guess, is this because I am running QT 4.7 beta2 instead of 4.6 
release series ?



More information about the Qt-interest-old mailing list