Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is it possible to use unicode string in template variable? #70

Closed
trivita opened this issue Feb 15, 2017 · 4 comments
Closed

is it possible to use unicode string in template variable? #70

trivita opened this issue Feb 15, 2017 · 4 comments

Comments

@trivita
Copy link

trivita commented Feb 15, 2017

like {{ åß∂ƒ }} for an instance

@elapouya
Copy link
Owner

elapouya commented Feb 15, 2017 via email

@trivita
Copy link
Author

trivita commented Feb 16, 2017

this is what i got

Traceback (most recent call last):
File "/Users/trivita/mydev/send2grouk/testtpl.py", line 100, in
main()
File "/Users/trivita/mydev/send2grouk/testtpl.py", line 90, in main
doc.render(context)
File "/usr/local/lib/python2.7/site-packages/docxtpl/init.py", line 126, in render
xml_src = self.build_xml(context,jinja_env)
File "/usr/local/lib/python2.7/site-packages/docxtpl/init.py", line 91, in build_xml
xml = self.render_xml(xml, context, jinja_env)
File "/usr/local/lib/python2.7/site-packages/docxtpl/init.py", line 83, in render_xml
template = Template(src_xml)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 926, in new
return env.from_string(source, template_class=cls)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 862, in from_string
return cls.from_code(self, self.compile(source), globals, None)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 565, in compile
self.handle_exception(exc_info, source_hint=source_hint)
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
reraise(exc_type, exc_value, tb)
File "", line 1, in template
jinja2.exceptions.TemplateSyntaxError: unexpected char u'\xe5' at 4067

@trivita
Copy link
Author

trivita commented Feb 16, 2017

looks like jinja2 doesnt support that

jinja2 doc says

As a matter of fact non ASCII characters are currently not allowed. This limitation will probably go away as soon as unicode identifiers are fully specified for Python 3.

@trivita trivita closed this as completed Feb 16, 2017
@trivita
Copy link
Author

trivita commented Feb 16, 2017

so python3 support this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants