[Zope] Re: Dealing with international character sets

Paulo Eduardo Neves neves@inf.puc-rio.br
Mon, 10 May 1999 22:11:30 -0300


Hi Alexander,

Alexander Staubo wrote:
> 
> Sorry for having to repost this, but I have not found an answer (nor
> received any response). Is this a Python thing, or a Zope thing? Does
> Zope/Python provide any suitable translation APIs for international
> character sets?

I'm using an external method that converts iso8859-1 chars to the
correspondent html entity. Maybe this can solve your problem. If you
want  I can post it to you.

> >I note that Zope is converting strings with certain international
> >characters into its own notation. Specifically, in my country our
> >alphabet contains three additional characters. For example, "oslash"
> >(\0xF8 on my system), which Zope expands into "\370".

The html entity ø has the position 248 in the iso8859-1 charset.
It is F8 in hex and 370 in octal. Both your system and Zope is correct.


> >Now, this is extremely inconvenient when dealing with database tables,
> >because obvious such things as name lookup won't work, and besides, any
> >strings that are put into the table fields will use Zope syntax, not a
> >"proper" character set (eg., ISO-8859-1, which is the one we use here).
> >Is there a solution? For example, a function to convert the Zope string
> >back to my kind of string?

I usually store string data in the database with the 8859-1 format. They
are better to read. When I want to display it I convert to htmlentities. 
I use this external method in a toplevel folder. I was thinking to adapt
it to somethin like html_quote modifier in #var.

Maybe ther is a problem with your database adapter. 

hope this helps,
--
Paulo Eduardo Neves
mailto:neves@inf.puc-rio.br
PUC-Rio de Janeiro