Re: [xml] Aliases for encodings

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Aug 23 2000 - 05:24:41 EDT


On Wed, Aug 23, 2000 at 09:44:50AM +0300, Vjacheslav Chekushin wrote:
[ Could you please subscribe to the list ? ]
> 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

 it's not one of the predefined names (when trying to find the canonical
name for the encoding).

> 2. Found registered handler for encoding windows-1257

 found the one you just provided.

> 3. converted 45 bytes to 45 bytes of input, 439 left
> 4. converted 439 bytes to 441 bytes of input

 Successful conversion

> 5. closed the encoding handler
[..]
> I can't understant 5.

  Most of the encodings actually need to maintain a state. The iconv interface
hence suggest to open/use/close encoding as needed. The open and close allows
to manage the associated state datastructure.

> 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.

  the data structure for the iconv processing have been deallocated in
the meantime, so it's clear you're gonna run into problems, as things are done
now. The iconv routines are really not designed to work that way and I'm
afraid trying to patch the existing API to support aliases will just add
code mess.
  It will work just fine, but only once, that's normal.

> (By the way, I work with libxml 2.2.2)

  Sounds that the best way to handle this is to add routines to provide
encoding aliases, and possibly remove them:

int xmlAddEncodingAlias(const char *name, const char *alias);
int xmlDelEncodingAlias(const char *alias);

  I will try to implement those before the next release,

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
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 - 04:43:19 EDT