Re: [xml] Aliases for encodings

Date view Thread view Subject view Author view

From: Vjacheslav Chekushin (slava@lmt.lv)
Date: Wed Aug 23 2000 - 02:44:50 EDT


>>
>> Hi,
>> I plan to use the aliases for some encodings, supported by iconv.
>> Is it the right(best?) way how to do it ?
>>
>> xmlCharEncodingHandlerPtr encHandler;
>> encHandler = xmlFindCharEncodingHandler("CP1257");
>> encHandler->name = xmlMemStrdup("WINDOWS-1257");
>> xmlRegisterCharEncodingHandler(encHandler);
>>
>> Can You show the better way if it exists?

> It looks like it should work, however I'm a bit unsure about
> possible errors if you reuse it or ipossible allocatio problem
> once the encHandler get unregistered.
>
> try it, and report problems if any,
>
> Daniel

Hi.
Yes, I tried it.
And that how it works:
First time after registering the alias for encoding everything is Ok:

I try to parse xml document with encoding "windows-1257" and get following
debug records:

1. Unknown encoding windows-1257
2. Found registered handler for encoding windows-1257
3. converted 45 bytes to 45 bytes of input, 439 left
4. converted 439 bytes to 441 bytes of input
5. closed the encoding handler

1. - not standard encoding
2. - found in registered encodings
3-4. - used
5. Closed ???

I can't understant 5.
Does it mean that I need to register this encoding again?
And why it is closed any way?

When my program tries to parse this document second time libxml returns NULL or
segmentation fault occurs.

(By the way, I work with libxml 2.2.2)

Thanks.

-- 
Vjacheslav Chekushin                                mailto:sck@lmt.lv
----
Message from the list xml@xmlsoft.org
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@xmlsoft.org


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Aug 23 2000 - 01:43:10 EDT