RE: Univarchar, Unichar in Sybase

From: Addison Phillips (
Date: Mon Jul 17 2006 - 16:25:16 CDT

  • Next message: Philippe Verdy: "Re: Univarchar, Unichar in Sybase"

    > When I insert Chinese/Japanese raw data to Sybase unichar /
    > univarchar column, should I insert the raw data (e.g. 海外旅行保険)
    > directly or insert it's Unicode (e.g. E6 B5 B7 E5 A4 96 E6 97
    > 85 E8 A1 8C E4 BF 9D E9 99 BA for UTF-8)??

    All text inside a computer system has a character encoding. Character
    encodings map the logical character to a sequence of bytes in the file or in
    the computer's memory.

    SQL statements are text. If you wish to insert some value into a SQL
    database (such as Sybase), you essentially send some text containing the SQL
    query to the database. This text has an encoding. If that encoding is UTF-8,
    the byte sequence might be E6 B5 B7 etc. If that text is in some other
    encoding, the byte sequence will be different.

    Generally your database client (or driver) and the database server cooperate
    to manage encodings. Your client is configured to use a specific encoding
    (usually at install time) when communicating with the database server. The
    server will expect queries to use this encoding and will use to it convert
    to the server's native (internal) encoding (such as UTF-16 or UTF-8).

    In other words, you usually want to send text encoded in whatever the
    connection encoding is to the database. Your configuration matters a great
    deal in this and you may want the connection encoding to be UTF-8 (so that
    you can transfer the full range of Unicode), even if your local runtime uses
    some other encoding. It is difficult to be more precise than that without
    more information.

    I should also note: your programming language or driver type may also
    influence how the data is actually encoded (for example, JDBC drivers
    usually work with java.lang.String objects, which use Unicode, and not
    necessarily the encoding used by, say, an Open Connect client).

    Sybase describes some of this in a document located here: http://www.sybase.

    Hope that helps,


    Addison Phillips
    Internationalization Architect - Yahoo! Inc.

    Internationalization is an architecture.
    It is not a feature.

    This archive was generated by hypermail 2.1.5 : Mon Jul 17 2006 - 16:29:44 CDT