Re: Handling of Surrogates

From: Bjoern Hoehrmann (derhoermi@gmx.net)
Date: Thu Apr 16 2009 - 20:00:05 CDT

  • Next message: Doug Ewell: "Re: Handling of Surrogates"

    * Sam Mason wrote:
    >I've got myself in a discussion about the correct handling of surrogate
    >pairs. The background is as follows; the Postgres database server[1]
    >currently assumes that the SQL it's receiving is in some user specified
    >encoding, and it's been proposed that it would be nicer to be able to
    >enter Unicode characters directly in the form of escape codes in a
    >similar form to Python, i.e. support would be added for:
    >
    > '\uxxxx'
    >and
    > '\Uxxxxxxxx'

    I think you would be better of doing it similar to Perl, which uses ex-
    plicit delimiters for the value. This has a number of benefits: you can
    parse it case-insensitively, there is no confusion if you, for example,
    want U+AFFE followed by the literal "AFFE", there is no confusion as to
    what the required length is (some formats allow only six digits), it is
    extendable (with Perl you can also use character names, alias names,
    etc.), and the answer to your question is more obvious. Perl generates a
    warning if you specify surrogate code points.

    -- 
    Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
    Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
    25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 
    


    This archive was generated by hypermail 2.1.5 : Thu Apr 16 2009 - 20:03:08 CDT