Re: Unicode and UTF-8
Jean-Baptiste Quenot <[email protected]>
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <[email protected]> |
Interesting usecase. I haven't come across this yet. I can reproduce your issue, see attached patch against unit tests in the "next" branch. Cheers, -- Jean-Baptiste Quenot http://jbq.caraldi.com/ ------------------------------------------------------------------------------ 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 _______________________________________________ Cheetahtemplate-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
0001-Add-dynamic-compile-Unicode-test-from-Gerold-Penz.patch
(application/octet-stream, 1.3 KB)
From ace8a512a35641e4c516ebd94f5435f0b4a83a4f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Quenot <[email protected]> Date: Mon, 15 Jun 2009 15:15:08 +0200 Subject: [PATCH] Add dynamic compile Unicode test from Gerold Penz --- src/Tests/Unicode.py | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) diff --git a/src/Tests/Unicode.py b/src/Tests/Unicode.py index 3910d8d..305cdfd 100644 --- a/src/Tests/Unicode.py +++ b/src/Tests/Unicode.py @@ -131,6 +131,27 @@ class JBQ_UTF8_Test7(CommandLineTest): assert unicode(template()) +class JBQ_UTF8_Test8(CommandLineTest): + def testStaticCompile(self): + source = """#encoding utf-8 +#set $someUnicodeString = u"Bébé" +$someUnicodeString""" + + template = self.createAndCompile(source)() + + a = unicode(template).encode("utf-8") + self.assertEquals("Bébé", a) + + def testDynamicCompile(self): + source = """#encoding utf-8 +#set $someUnicodeString = u"Bébé" +$someUnicodeString""" + + template = Template(source = source) + + a = unicode(template).encode("utf-8") + self.assertEquals("Bébé", a) + class Unicode_in_SearchList_Test(CommandLineTest): def test_BasicASCII(self): source = '''This is $adjective''' -- 1.6.0.4