Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Postgres UTF-8 woes

by choroba (Cardinal)
on May 08, 2019 at 18:57 UTC ( [id://1233468]=note: print w/replies, xml ) Need Help??


in reply to Postgres UTF-8 woes

Do you send decoded unicode or encoded (e.g. UTF-8)? Have you set client or server encoding?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Postgres UTF-8 woes
by 1nickt (Canon) on May 08, 2019 at 21:13 UTC

    Hi choroba, thank you for replying.

    Client and server encoding are both set to UTF-8:

    Activity=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access +privileges -----------+---------+----------+-------------+-------------+--------- +------------ Activity | ******* | UTF8 | en_US.UTF-8 | en_US.UTF-8 | postgres | ******* | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | ******* | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/***** +** + | | | | | *******= +CTc/******* template1 | ******* | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/***** +** + | | | | | *******= +CTc/******* (6 rows) Activity=# show client_encoding; client_encoding ----------------- UTF8 (1 row)
    The data is passed decoded from UTF-8, which I believe is correct. DBIx seems to handle it as expected (given the encodings specified in the schema), but the SQL then produced by DBD::Pg/DBI is garbled, as shown. Passing data encoded to UTF-8 to DBIx results in even more garbled content in the DB.


    The way forward always starts with a minimal test.
      What version of DBD::Pg do you use? From the Changes it seems 3.3.0 is the minimum version with reasonable UTF-8 support, and probably even 3.6.0.

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

        We are running with version 3.7.4. Can I ask if you are you passing Unicode to Pg via DBIx::Class and Pg::DBD successfully?

        Thank you.


        The way forward always starts with a minimal test.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1233468]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found