Search Postgresql Archives

Re: Question on inserting non-ascii strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Which "warnings" are you talking about?  I thought you said you had
> plain SQL working OK, but were struggling to pass parameters containing
> UTF-8 encoded characters.
> 
> Are you sure that your Perl code is passing the string encoded as UTF8?

Excellent point: Perl will only pass through the
converted UTF8, if I remember to convert it from 
unicode!

The earlier version of the database used SQL_ASCII
and took the unicode byte as-is with a nastygram
about trans-ascii byte -- which led me down the 
path of E'xxx'. While trying to make that work I'd
accidentally fat-figered out the utf8 conversion 
attempting to comment it out.

Character   Unicode Code    Unicode Name                      UTF Encoding

(from http://www.nlm.nih.gov/databases/dtd/medline_character_database.html#notes)

    use utf8;

    x $c = "\x{F8}"

    x utf8::encode $c;

    x $c
    0  'ø'           <-- UTF8 for a slashed o.

    $sth->execute( $c )

    x $d = $dbh->selectall_arrayref( 'select * from foo' );
    0  ARRAY(0x18ef0d0)
       0  ARRAY(0x18cc1e8)
          0  'ø'     <-- bytes in correct order

    x  utf8::decode $d->[0][0]
    DB<106>  x $d
    0  ARRAY(0x18ef0d0)
       0  ARRAY(0x18cc1e8)


I'm still not sure whether using UTF8 or unicode is 
the best way going forward, but will probably stick
with UTF8 in case I have to deal with any offball
character sets.

thanx

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux