[stringtemplate-interest] pystringtemplate 2.2 UnicodeDecodeError
Bohumil Simcik
limuhob at gmail.com
Fri May 11 05:39:55 PDT 2007
Hello.
Sorry for my English.
I'm trying python stringtemplate 2.2. If a template includes character above
128 ordinaly, I will get UnicodeDecodeError:
problem parsing template 'bug'
Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/stringtemplate/StringTemplate.py",
line 833, in breakTemplateIntoChunks
chunkifier.template(self)
File
"/usr/lib/python2.4/site-packages/stringtemplate/language/TemplateParser.py",
line 72, in template
la1 = self.LA(1)
File "/usr/lib/python2.4/site-packages/antlr/antlr.py", line 2025, in LA
return self.inputState.input.LA(i)
File "/usr/lib/python2.4/site-packages/antlr/antlr.py", line 1683, in LA
self.fill(k)
File "/usr/lib/python2.4/site-packages/antlr/antlr.py", line 1677, in fill
self.queue.append(self.input.nextToken())
File
"/usr/lib/python2.4/site-packages/stringtemplate/language/DefaultTemplateLexer.py",
line 113, in nextToken
self.mLITERAL(True)
File
"/usr/lib/python2.4/site-packages/stringtemplate/language/DefaultTemplateLexer.py",
line 150, in mLITERAL
if (self.LA(1)==u'\\') and (self.LA(2)==u'$'):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0:
ordinal not in range(128)
Problematic code:
import stringtemplate
group = stringtemplate.StringTemplateGroup("myGroup", "./")
query = group.getInstanceOf("bug")
print query
Problematic template bug (encoded in utf8):
příliš žluťoučký kůň pěje ďábelské ódy
Is this bug or my mistake ?
With pleasure, Bohumil Šimčík
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20070511/eadf2b1f/attachment.html
More information about the stringtemplate-interest
mailing list