[stringtemplate-interest] pystringtemplate 2.2 UnicodeDecodeError

Terence Parr parrt at cs.usfca.edu
Fri May 11 12:09:28 PDT 2007


Hi. That is most likely an issue with the python version I'm afraid.   
PyST has lagged behind because I don't have someone who can update  
it.  Sorry!

Ter
On May 11, 2007, at 5:39 AM, Bohumil Simcik wrote:

> 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
>
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list