FAQ
Trying to get DBI to select from a database with unicode characters

Anyone out there successfully know of what I need to do to get unicode
data out of a database? I've seen a lot of postings on the net with
people having issues with this.... my result set gets ?????
instead...

It seems to be DBI, the DBD, or the ODBC driver that's returning "????"

I know what's going on.. but I'm at a loss what to do to "fetch" the
nvar data.

And I know that the characters are encoded in the database as Unicode.
Can someone confirm or tell me the bad news definitivelyu that DBI
whether DBI supports Unicode.

Nikko

Search Discussions

  • Mark Vandenbroeck at Oct 8, 2001 at 10:06 pm
    Nikko,

    Depending on what you are trying to do, it might not really matter whether
    DBI supports Unicode or not.
    Oracle always does a characterset translation between client and server. It
    translates data coming from the server to the characterset specified in your
    NLS_LANG environment variable. It defaults to US7ASCII if this variable is
    not set.

    You should set the characterset part of your NLS_LANG environment variable
    to either AL24UTFFSS (if your client is pre-8.1) or UTF8 (8.1 or higher).
    Then all data fetched from the database will end up encoded in UTF-8 in your
    Perl variables. What happens after that is up to your program.

    There is no direct support for UCS-2 encoding that I know of. But
    translation shouldn't be hard. I saw some module on CPAN that could do this.

    By the way : when Oracle doesn't know how to translate a character to your
    client characterset, it replaces it by a '?'.

    Hope this helps,

    Mark


    ----- Original Message -----
    From: "Nikko Odiseos" <nodiseos@interwoven.com>
    To: <dbi-users@perl.org>
    Sent: Monday, October 08, 2001 9:30 PM
    Subject: problems with unicode

    Trying to get DBI to select from a database with unicode characters

    Anyone out there successfully know of what I need to do to get unicode
    data out of a database? I've seen a lot of postings on the net with
    people having issues with this.... my result set gets ?????
    instead...

    It seems to be DBI, the DBD, or the ODBC driver that's returning "????"

    I know what's going on.. but I'm at a loss what to do to "fetch" the
    nvar data.

    And I know that the characters are encoded in the database as Unicode.
    Can someone confirm or tell me the bad news definitivelyu that DBI
    whether DBI supports Unicode.

    Nikko
  • Nikko Odiseos at Oct 8, 2001 at 10:29 pm
    Thanks Mark. Actually it is a SQL Server. The content in the database is
    of nVarchar, nText, etc. so things are being stored as doublebyte...

    Do you know how this would appply there?

    Appreciate the help,

    Nikko


    -----Original Message-----
    From: Mark Vandenbroeck
    Sent: Monday, October 08, 2001 3:15 PM
    To: Nikko Odiseos; dbi-users@perl.org
    Subject: Re: problems with unicode


    Nikko,

    Depending on what you are trying to do, it might not really matter whether
    DBI supports Unicode or not.
    Oracle always does a characterset translation between client and server. It
    translates data coming from the server to the characterset specified in your
    NLS_LANG environment variable. It defaults to US7ASCII if this variable is
    not set.

    You should set the characterset part of your NLS_LANG environment variable
    to either AL24UTFFSS (if your client is pre-8.1) or UTF8 (8.1 or higher).
    Then all data fetched from the database will end up encoded in UTF-8 in your
    Perl variables. What happens after that is up to your program.

    There is no direct support for UCS-2 encoding that I know of. But
    translation shouldn't be hard. I saw some module on CPAN that could do this.

    By the way : when Oracle doesn't know how to translate a character to your
    client characterset, it replaces it by a '?'.

    Hope this helps,

    Mark


    ----- Original Message -----
    From: "Nikko Odiseos" <nodiseos@interwoven.com>
    To: <dbi-users@perl.org>
    Sent: Monday, October 08, 2001 9:30 PM
    Subject: problems with unicode

    Trying to get DBI to select from a database with unicode characters

    Anyone out there successfully know of what I need to do to get unicode
    data out of a database? I've seen a lot of postings on the net with
    people having issues with this.... my result set gets ?????
    instead...

    It seems to be DBI, the DBD, or the ODBC driver that's returning "????"

    I know what's going on.. but I'm at a loss what to do to "fetch" the
    nvar data.

    And I know that the characters are encoded in the database as Unicode.
    Can someone confirm or tell me the bad news definitivelyu that DBI
    whether DBI supports Unicode.

    Nikko

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedOct 8, '01 at 7:28p
activeOct 8, '01 at 10:29p
posts3
users2
websitedbi.perl.org

People

Translate

site design / logo © 2022 Grokbase