Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGOaa-00021L-Ka for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2019 14:29:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGOaZ-00079x-En for pgsql-general@arkaria.postgresql.org; Fri, 04 Oct 2019 14:29:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGOaZ-00079q-3k for pgsql-general@lists.postgresql.org; Fri, 04 Oct 2019 14:29:47 +0000 Received: from smtp.burggraben.net ([2a01:4f8:140:50a2::3:1]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGOaW-0007yJ-RD for pgsql-general@lists.postgresql.org; Fri, 04 Oct 2019 14:29:46 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.burggraben.net (Postfix) with ESMTP id 9DEB9600301 for ; Fri, 4 Oct 2019 16:29:42 +0200 (CEST) X-Spam-Scanned: by amavisd-new at exwg.net Received: from smtp.burggraben.net ([127.0.0.1]) by localhost (ns.burggraben.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hHHTwEY2xOpE for ; Fri, 4 Oct 2019 16:29:33 +0200 (CEST) Received: from elch.exwg.net (elch.exwg.net [IPv6:2001:470:7120:1:127b:44ff:fe4f:148d]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "elch.exwg.net", Issuer "Christoph Moench-Tegeder" (verified OK)) by smtp.burggraben.net (Postfix) with ESMTPS for ; Fri, 4 Oct 2019 16:29:33 +0200 (CEST) Received: by elch.exwg.net (Postfix, from userid 1000) id B61321399EF; Fri, 4 Oct 2019 16:29:32 +0200 (CEST) Date: Fri, 4 Oct 2019 16:29:32 +0200 From: Christoph Moench-Tegeder To: pgsql-general@lists.postgresql.org Subject: Re: Perl DBI converts UTF-8 again to UTF-8 before sending it to the server Message-ID: <20191004142932.GA2532@elch.exwg.net> References: <20191004132529.GA2871@c720-r342378> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191004132529.GA2871@c720-r342378> User-Agent: Mutt/1.12.2 (2019-09-21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ## 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