durusmail: quixote-users: utf-8 applications, front to back
utf-8 applications, front to back
2004-12-16
Mario Ruggier (2 parts)
2004-12-17
utf-8 applications, front to back
Mario Ruggier
2004-12-16
Hi,

i'd like an to encode all pages sent to a client in utf-8, and only
utf-8. Also, i'd like that any string data input by a user via form
fields will always be utf-8. My understanding is that if string data is
entered in a utf-8 encoded page, the data will be also encoded in
utf-8.

I have made a single-file application, included below, to capture some
user data, and store it in a durus file. It can also modify and delete
saved items. The problem is whenever a special char is included, such
as in "Réné" or "Françoise", an exception is thrown:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
599: ordinal not in range(128)

However, the item is written out to the db anyway (maybe not
correctly?), and when requesting the item again (a list of clickable
keys per item is displayed on each request), the same exception is
thrown.

What is needed to get this application to work with only utf-8, front
to back, and back to front ?

To run the test app below, just do:  python ./test_text.py
Note this will create a test_text.durus file in the current directory...

I am on OS X 10.3.6, with py 2.3, qx 2.0a3, and durus 1.3.

Any help will be appreciated...

mario

reply