mako icon indicating copy to clipboard operation
mako copied to clipboard

Incorrect message when non-ascii char appears in template

Open sqlalchemy-bot opened this issue 8 years ago • 2 comments

Migrated issue, originally created by Glenn WIkle

You might think it is minor to have default values in an exception message but given that Mako is a parsing system, users need more help figuring out where the incorrect syntax is in their input files.

In the current version of lexer.py line 215 is this:

                  0, 0, filename)

i think the two zeros here result in the message which looks like

Unicode decode operation of encoding 'ascii' failed in file 'templates/summary.html' at line: 0 char: 0

So any non-ascii char anywhere in the input file template will generate this same message.

I spent quite a while looking for unprintable characters in my template at 0,0 before I dug into the code to find that the non-ascii character was really in a different position.

(Next I'll have to figure out why it's restricting the character set to ascii)

sqlalchemy-bot avatar Jun 28 '16 20:06 sqlalchemy-bot

Michael Bayer (@zzzeek) wrote:

feel free to supply a PR with tests.

sqlalchemy-bot avatar Jun 28 '16 21:06 sqlalchemy-bot

Changes by Michael Bayer (@zzzeek):

  • removed milestone (was: "0.5")

sqlalchemy-bot avatar Jun 28 '16 21:06 sqlalchemy-bot