Re: EncodingManager usage note

From: Andrew Dunbar (hippietrail@yahoo.com)
Date: Sat Jan 25 2003 - 20:28:37 EST

  • Next message: Patrick Lam: "Re: RE : INS, caret colour, etc."

     --- Tomas Frydrych <tomas@frydrych.uklinux.net>
    wrote: >
    > Andrew Dunbar <hippietrail@yahoo.com> wrote:
    > > getNativeEncodingName()
    > > getNativeSystemEncodingName()
    > > getNative8BitEncodingName()
    > > getNativeUnicodeEncodingName()
    > >
    > > I've noticed that some code treats the second two
    > > as though they are mutually exclusive. This is
    not
    > > the case at all. As noted in the
    > > comment/documentation for
    > > getNative8BitEncodingName() - it is perfectly
    > > okay for it to return UTF-8 or any multibyte CJK
    > > encoding - the only requirement is that the
    > > encoding is a superset of ASCII.
    > > Some code is calling this function to get an
    > > ISO-8859-x encoding when the native encoding is
    > > UTF-8. I believe there are some very subtle bugs
    > > which may be due to this.
    >
    > It is most definitely not OK to return utf8 or
    > multibyte encodings in getNative8BitEncodingName();
    > for start neither of these are 8-bit encodings, but
    > more importantly, this function was added
    > specifically for the code that that you mention.

    I can't remember anymore whether I wrote the code or
    you wrote it and I just added the comment. In any
    case I intended to write it. The problem is that in
    Windows code this is used to decide between strings
    based on 8-bit codepoints and strings based on 16-bit
    codepoints. On Linux it's used to decide between
    "standard" encodings and UTF-8. These usages are not
    compatible. My original intention when thinking up
    this function was to solve some Windows problems where
    8-bit strings were needed even when the OS was in
    Unicode mode.

    Anyway the two will be split into less ambiguously-
    named functions and all will be well. I've already
    started...

    Andrew.

    > Tomas

    =====
    http://linguaphile.sourceforge.net/cgi-bin/translator.pl http://www.abisource.com

    __________________________________________________
    Do You Yahoo!?
    Everything you'll ever need on one web page
    from News and Sport to Email and Music Charts
    http://uk.my.yahoo.com



    This archive was generated by hypermail 2.1.4 : Sat Jan 25 2003 - 20:31:51 EST