pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthias Apitz <guru@unixarea.de>
To: Francisco Olarte <folarte@peoplecall.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: SELECT d02name::bytea FROM ... && DBI::Pg
Date: Thu, 10 Oct 2019 19:26:28 +0200
Message-ID: <20191010172628.GA3951@c720-r342378> (raw)
In-Reply-To: <CA+bJJbx2q0ZrnC2NmF1uaGMfJ8HBfBh08cW4JH1wEV-ZDYvnPw@mail.gmail.com>
References: <20191010112458.GA271079@sh4-5.1blu.de>
	<CA+bJJbx2q0ZrnC2NmF1uaGMfJ8HBfBh08cW4JH1wEV-ZDYvnPw@mail.gmail.com>

El día jueves, octubre 10, 2019 a las 06:46:02p. m. +0200, Francisco Olarte escribió:

> Matthias:
> 
> On Thu, Oct 10, 2019 at 1:25 PM Matthias Apitz <guru@unixarea.de> wrote:
> > I can SELECT && print a column in hex with:
> > pos71=# select d02name::bytea from d02ben where d02bnr = '00001048313' ;
> > ...
> >  \x50c3a46461676f67697363686520486f6368736368756c65205765696e67617274656e2020 ...
> >
> > but when I use the same in Perl DBI::Pg with:
> > $sth=$dbh->prepare( "select d02name::bytea from d02ben where d02bnr = '00001048313'");
> ...
> > It prints the UTF-8 string and not the hex string:
> 
> May be because perl does not need the contents in hex DBI converts it
> to a native string, which is very similar to a "bytea" inside the db (
> not in the wire protocol, but it does a similar thing for numbers ).

Hmm. But *I* do need the content in hex to see if the varchar column
contains correct encoded UTF-8 data. We're on the way to port a huge
database application from Sybase to PostgreSQL and are facing any kind of
problems one can think of. Magically, sometimes strings, expected to be
coded in UTF-8, arrive in the Perl $variables coded in ISO-8859-1 and than cause
other problems when German Umlauts should be translated into HTML
encodings like &uuml; etc. to be presented in the web browser.

Perl (and Java) sucks, it does magic things below the surface of
string (objects). That's why I like C :-)

	matthias
-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub





view thread (6+ messages)  latest in thread

Message-ID: <20191010172628.GA3951@c720-r342378>
Permalink:  ../20191010172628.GA3951@c720-r342378/
Also on:    postgresql.org/message-id/20191010172628.GA3951@c720-r342378

 · 

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: guru@unixarea.de, folarte@peoplecall.com
  Subject: Re: SELECT d02name::bytea FROM ... && DBI::Pg
  In-Reply-To: <20191010172628.GA3951@c720-r342378>
  References: <20191010112458.GA271079@sh4-5.1blu.de> <CA+bJJbx2q0ZrnC2NmF1uaGMfJ8HBfBh08cW4JH1wEV-ZDYvnPw@mail.gmail.com> <20191010172628.GA3951@c720-r342378>

* 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