Re: Find out encoding of data - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Find out encoding of data
Date
Msg-id D960CB61B694CF459DCFB4B0128514C24FA270@exadv11.host.magwien.gv.at
Whole thread Raw
In response to Re: Find out encoding of data  (joynes <joynes@hotmail.com>)
Responses Re: Find out encoding of data  (joynes <joynes@hotmail.com>)
List pgsql-general
joynes wrote:
> This doesnt work for me but it is exactly what I want. When I run your
> example I just get:
>
> >SELECT decode('10EUR', 'escape');
>  decode
> --------
>  10EUR
> (1 rad)
>
> I get the same result, both if the database is UTF8 or
> ISO-Latin1 and also
> with different versions of postgres (7 and 8)
>
> And when I read the documentation for 'decode' it tells that
> it just decodes
> binary strings encoded with 'encode'.
> How did you get that result from running decode?

I suspect that somewhere along the line the Euro symbol I
used in the query got changed to 'EUR'.

Try some other string with weird characters.

It will show all non-ASCII characters in escaped octal
notation, while ASCII characters will remain as they are.

This should help you - if I understood you correctly,
you want to know the actual bytes stored in a database
field. To find our the numeric representation of an ASCII
field, you can use the function ascii().

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Erik Jones
Date:
Subject: Re: datestyle question
Next
From: "Albe Laurenz"
Date:
Subject: Re: Can't access Cluster