Re: Find out encoding of data

From: "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at>
To: "joynes *EXTERN*" <joynes(at)hotmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Find out encoding of data
Date: 2007-10-03 05:49:03
Message-ID: D960CB61B694CF459DCFB4B0128514C24FA270@exadv11.host.magwien.gv.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2007-10-03 06:04:58 Re: Can't access Cluster
Previous Message Erik Jones 2007-10-03 05:27:43 Re: datestyle question