pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christoph Moench-Tegeder <cmt@burggraben.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Perl DBI converts UTF-8 again to UTF-8 before sending it to the server
Date: Fri, 4 Oct 2019 16:29:32 +0200
Message-ID: <20191004142932.GA2532@elch.exwg.net> (raw)
In-Reply-To: <20191004132529.GA2871@c720-r342378>
References: <20191004132529.GA2871@c720-r342378>

## Matthias Apitz (guru@unixarea.de):

> my $text = "\xc3\xa4";
> print "text: ".$text."\n";

Your output is lying to you:
you need a binmode(STDOUT, ':encoding(utf8)'), which will make this print
"ä", and a utf8::decode($text), after which you get "ä". And when you
pass that $text through DBD::Pg, it will still be an "ä". And when you
change $text to "ä", it still works. Most other combinations will
either fail with "\xc3\xa4" or "ä".

Welcome to modern perl's handling of utf8. Cue "Everything is Fine" meme.

Regards,
Christoph

-- 
Spare Space





view thread (7+ messages)  latest in thread

Message-ID: <20191004142932.GA2532@elch.exwg.net>
Permalink:  ../20191004142932.GA2532@elch.exwg.net/
Also on:    postgresql.org/message-id/20191004142932.GA2532@elch.exwg.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: cmt@burggraben.net
  Subject: Re: Perl DBI converts UTF-8 again to UTF-8 before sending it to the server
  In-Reply-To: <20191004142932.GA2532@elch.exwg.net>
  References: <20191004132529.GA2871@c720-r342378> <20191004142932.GA2532@elch.exwg.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox