encoding problem

Started by jef peeraerover 19 years ago4 messagesgeneral
Jump to latest
#1jef peeraer
jef.peeraer@telenet.be

i never thought i would be bblocked by an encoding problem :-(
My database is in LATIN1 , i have entries like this in a table called
gemeenten
Column | Type | Modifiers
---------------+----------+--------------------------------------------------------
id | integer | serial....
gemeente | text | not null
postcode | smallint | not null
provincies_id | integer |

This data is copied from a dump from that table

9780 Qu�vy 7040 7
9781 Qu�vy-le-Grand 7040 7
9782 Qu�vy-le-Petit 7040 7

So, the accents are there. But with my web page, which is set to
ISO-8859-1, i don't get the accents.
The web-pages are build with XUL, where i set the charset to ISO-8859-1,
but communication with the server is through XMLHttpRequest.
Do I have to specify the charset as well in the communication between
server and client ? Or where else could it go wrong.

jef peeraer

#2pobox@verysmall.org
pobox@verysmall.org
In reply to: jef peeraer (#1)
Re: encoding problem

jef peeraer wrote:

i never thought i would be bblocked by an encoding problem :-(
My database is in LATIN1 , i have entries like this in a table called
gemeenten
Column | Type | Modifiers
---------------+----------+--------------------------------------------------------

id | integer | serial....
gemeente | text | not null
postcode | smallint | not null
provincies_id | integer |

This data is copied from a dump from that table

9780 Quévy 7040 7
9781 Quévy-le-Grand 7040 7
9782 Quévy-le-Petit 7040 7

So, the accents are there. But with my web page, which is set to
ISO-8859-1, i don't get the accents.
The web-pages are build with XUL, where i set the charset to ISO-8859-1,
but communication with the server is through XMLHttpRequest.
Do I have to specify the charset as well in the communication between
server and client ? Or where else could it go wrong.

jef peeraer

I am not sure where your problem is, but we have used a PostgreSQL
database with the default encoding (ISO something or ANSI something,
can't recall right now, but not Unicode or so) for several years storing
all kind of encodings inside and outputting them successfully.

Only the browser encoding must match the original encoding.

Don't know if this helps, just wanted to give you our example.

All best,
Iv

#3stevegy
stevegy@126.com
In reply to: jef peeraer (#1)
Re:  encoding problem

Hi Jef,

I use the prototype 1.4 to ajax some web pages. I have to encodeURI the post form data especial the string form value, otherwise the server will receive wrong encoding characters.
If you can not see the query result in correct web page encoding, maybe the page container of this XUL ajax control is not match of your setting of the web page.

regards

Steve Yao

-----原始邮件-----
发件人:"jef peeraer" <jef.peeraer@telenet.be>
发送时间:2006-10-13 17:14:53
收件人:pgsql-general@postgresql.org
抄送:(无)
主题:[GENERAL]&nbsp;encoding&nbsp;problem

i never thought i would be bblocked by an encoding problem :-(
My database is in LATIN1 , i have entries like this in a table called
gemeenten
Column | Type | Modifiers
---------------+----------+--------------------------------------------------------
id | integer | serial....
gemeente | text | not null
postcode | smallint | not null
provincies_id | integer |

This data is copied from a dump from that table

9780 Quévy 7040 7
9781 Quévy-le-Grand 7040 7
9782 Quévy-le-Petit 7040 7

So, the accents are there. But with my web page, which is set to
ISO-8859-1, i don't get the accents.
The web-pages are build with XUL, where i set the charset to ISO-8859-1,
but communication with the server is through XMLHttpRequest.
Do I have to specify the charset as well in the communication between
server and client ? Or where else could it go wrong.

jef peeraer

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

#4jef peeraer
jef.peeraer@telenet.be
In reply to: jef peeraer (#1)
Re: encoding problem

jef peeraer schreef:

i never thought i would be bblocked by an encoding problem :-(
My database is in LATIN1 , i have entries like this in a table called
gemeenten
Column | Type | Modifiers
---------------+----------+--------------------------------------------------------

id | integer | serial....
gemeente | text | not null
postcode | smallint | not null
provincies_id | integer |

This data is copied from a dump from that table

9780 Qu�vy 7040 7
9781 Qu�vy-le-Grand 7040 7
9782 Qu�vy-le-Petit 7040 7

So, the accents are there. But with my web page, which is set to
ISO-8859-1, i don't get the accents.
The web-pages are build with XUL, where i set the charset to ISO-8859-1,
but communication with the server is through XMLHttpRequest.
Do I have to specify the charset as well in the communication between
server and client ? Or where else could it go wrong.

jef peeraer

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

thanks for the help. The problem was lying in the fact that use
json_encode procedure from PHP. This procedure requires that the string
to be encoded be in UTF-8 format. So basically, my database stays in
LATIN1 and i set client encoding to UTF-8, as well as all web pages.

jef peeraer