Re: XML_Char and Unicode

From: Hubert Figuiere (hfiguiere_at_teaser.fr)
Date: Wed Feb 18 2004 - 12:45:19 EST

  • Next message: Dom Lachowicz: "Re: XML_Char and Unicode"

    On Wed, 2004-02-18 at 18:41, Frodo Looijaard wrote:

    > I seem to be missing something regarding the use of XML_Char in combination
    > with Unicode. In short: can XML_Char only be used for ASCII, or also for
    > non-ASCII characters?

    XML_Char* can be used to store UTF-8 encoded strings. This is what you
    must do for style properties.

    > The longer story: the current version of libpsiconv stores all data
    > internally as UCS2. This includes things like style names. To add a style,
    > I use:
    > getDoc()->appendStyle(propsArray)
    > where getDoc is a member of the IE_Imp class, and propsArray is an XML_Char **.
    > The question is: how to put the stylename safely in an XML_Char * ? Do I
    > need a charset conversion to ASCII?

    Convert your UCS-2 to UTF-8, using UT_iconv()
    Reminder: UTF-8 allow storing Unicode strings using a multibyte encoding
    compatible with ASCII string processing and with ASCII charset as long
    as we fall in the ASCII range. There are only a very few limitations
    with UCS-2 interchange.

    Hub



    This archive was generated by hypermail 2.1.4 : Wed Feb 18 2004 - 12:44:40 EST