UnicodeEncodeError with wheezy.template

Create issue
Issue #30 resolved
ivanpetuhov created an issue

Error in template:

@def title():
  File "env/lib/python2.7/site-packages/wheezy/template/engine.py", line 82, in compile_template
    tokens = self.lexer.tokenize(template_source)
  File "env/lib/python2.7/site-packages/wheezy/template/lexer.py", line 59, in tokenize
    npos, token, value = tokenizer(m)
  File "env/lib/python2.7/site-packages/wheezy/template/ext/core.py", line 54, in var_token
    value = str(source[start:end])

Comments (4)

  1. ivanpetuhov reporter

    this change solve the problem:

    value = str(source[start:end].encode('utf-8')).decode('utf-8')

    and in template:

    @def title():
  2. Andriy Kornatskyy repo owner

    The issue is python2 specific, the use of unicode string is important. The following should work as well:

    value = source[start:end]
  3. Log in to comment