This is a discussion on Find out encoding of data within the Pgsql General forums, part of the PostgreSQL category; --> Hi! I have this problem that Im not sure if my stored data has the correct coding. When I ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi! I have this problem that Im not sure if my stored data has the correct coding. When I view the data from a postgres console I just see the characters and depending on my console-encoding it looks differently. What I really want to see is the hexadecimal or octal value of the bytes of the retrieved data. Can postgres give me this somehow (without exporting tables to files and look at the files). /br joynes -- View this message in context: http://www.nabble.com/Find-out-encod...html#a12983073 Sent from the PostgreSQL - general mailing list archive at Nabble.com. ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org/ |
| |||
| joynes wrote: > What I really want to see is the hexadecimal or octal value > of the bytes of the retrieved data. Can postgres give me > this somehow (without exporting tables to files and look at > the files). Maybe 'decode' can help you: test=> SELECT decode('10EUR', 'escape'); decode ---------------- 10\342\202\254 (1 row) Yours, Laurenz Albe ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| |||
| Hi! 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? /br joynes -- View this message in context: http://www.nabble.com/Find-out-encod...html#a12995704 Sent from the PostgreSQL - general mailing list archive at Nabble.com. ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |
| |||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq |
| ||||
| Yeah you're right. I didnt test it with any special characters. It works when I do Thx a lot! -- View this message in context: http://www.nabble.com/Find-out-encod...html#a13014617 Sent from the PostgreSQL - general mailing list archive at Nabble.com. ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend |
| Thread Tools | |
| Display Modes | |
|
|