Locale/UTF8 problem in firefox

Andrej Marjan amarjan-e+AXbWqSrlAAvxtiuMwx3w at public.gmane.org
Wed Sep 5 03:21:48 UTC 2007


On September 4, 2007 09:05:08 pm Madison Kelly wrote:
> Hi all,
>
>    I've got an odd problem with firefox. I have a form that a user can
> enter text into. On save, this is stored in a PostgreSQL database set to
> UTF-8 (SET client_encoding = 'UTF8';).
>
>    The problem is, if I enter a UTF8 string like:
>
> 二本五 test.
>
>    I can see it in the database as:
>
> nmc=> SELECT dom_admin_note FROM domains WHERE dom_id=2;
>   dom_admin_note
> ----------------
>   二本五 test.
> (1 row)
>
>    And when I print it to SYSLOG I see:
>
> [Tue Sep  4 20:55:24 2007] ga.cgi: ga.lib: 388; 'dom_admin_note': [二本
> 五 test.]
>
>    But Firefox shows it as:
>
> <!-- ga.lib 389 'dom_admin_note': [二本五 test.] -->
> 二本五 test.
>
>    First line is viewed in the document source, the second as it appears
> in the forms 'textarea' field. This is a problem in itself, but doubly
> so because if a user changes something else, this mangled string gets
> saved over the good string.
>
>    Has anyone else here seen a problem like this? Any idea what's going
> on? My system's locale is 'en_CA.utf8', in case it matters. This error
> happens even after having cleared the mangled text, re-entered the
> Japanese text, resaved and redisplayed.

Does your program tell the browser that the page is in utf-8? IIRC by default, 
Firefox will interpret pages with no character set info as latin-1.

The best place to set it is in the HTTP headers, but you can also add a meta 
tag with the information.
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list