Re: Special Characters in Content from MySQL Database

Nico Grubert <[email protected]>
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
>> I use
>> tal:content="python:unicode(publication.authors,'Latin-1')"
>> With this trick I don't get an error message anymore, but the content 
>> still doesn't render correctly. All Umlauts get changed to "?".
>> Any Ideas?
>> We use Zope 2.7.0 and Silva 1.1.
>> Thanks a lot for your help


Dear Timo,

I am pretty sure that your Silva expects unicode strings while your 
content from MySQL is not unicode but ascii.
If I remember correctly the MySQL database adapter for Zope does not 
provide an option to output unicode strings. This is only 1 of many 
other reasons why I switched from MySQL to PostgreSQL whose Psycopg DA 
provides this useful option.

You may try:
tal:content="python:unicode(publication.authors,'Latin-1').encode('UTF-8')

Does this work or do the "?" still appear?

Regards to Rheinland-Pfalz, :-)
    Nico
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.