Unicode and UTF-8

Gerold Penz <[email protected]>
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
Hello!

My templates are UTF-8-encoded. If I fill a variable with an 
unicode-value -- inside the template -- then Cheetah gives back a false 
encoded value. My english is not good. I don't know, how I could explain 
it better.

Here's a simple example, which demonstrates it:


     #!/usr/bin/env python
     #coding: utf-8

     from Cheetah.Template import Template

     source = """#encoding utf-8
     #set $unicode_value = u"Österreich"
     $unicode_value
     """

     template = Template(source = source)
     print repr(template.respond())

     # -->                 u'\xc3\x96sterreich\n'
     # Shouldn't it be be: u'\xd6sterreich\n'?


This string u'\xc3\x96sterreich\n' is not unicode. It is UTF-8, which 
thinks that it is unicode.

What can I do?

Regards,
Gerold
:-)

-- 
Waldhart Software
A-6405 Pfaffenhofen, Unterdorf 145
Tel: +43 5262 64574, Fax: +43 5262 64514

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
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.