[silva-dev] Special Characters in Content from MySQL Database

Nico Grubert nicogrubert at gmail.com
Fri Jun 16 14:19:14 CEST 2006


>> 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



More information about the silva-dev mailing list