question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Decode error when encountering accents chars

See original GitHub issue

Good evening,

In some of the scripts i’m executing, people used accents chars in comments (not in vars at least! 😌 )

I created a small case that is easier to debug. The following code crashes :

duk_peval_string(ctx, "/* àéè */");

The error is : SyntaxError: decode failed (line 0)

If i remove the accents, everything works fine

Thansk in advance Best

R. Bloch

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
svaaralacommented, Sep 16, 2017

The other school of thought is that UTF-8 decoding should in general be strict and always reject invalid sequences so that they can be detected and fixed. Pros and cons in each I guess.

I’ll improve the error message.

0reactions
rblochcommented, Sep 16, 2017

Yes usually it’s way more developer friendly to tolerate invalid char values and replace them like you said.

I agree on the replacement char solution, that would trivially solve 99% of the problems as usually the non proper chars are set in the comments.

Maybe another simpler improvement would be to just slightly change the error message to SyntaxError: char decode failed

Which makes you understand immediately that you’ve some weird chars -> encoding. It’ll still be annoying as the dev will have to remove them somehow (src or on the fly) but at least he’ll be 100% sure of what is the problem. I think that just a decode failed is not verbose enough.

Best 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

When Bad Things Happen to Good Characters
My character is an "e" with an acute accent, character code 233 (decimal) in ... If é is UTF-8 encoded, but displayed without...
Read more >
html - E with accent doesn't show correctly - Stack Overflow
The browser displays these when it can't make sense of the numbers it is reading. UTF-8 is self-synchronzising. Unlike other multi-byte character encodings, ......
Read more >
Unable to decode special characters - Boomi Community
Hi, I'm running into an issue when reading data from MySQL that contains special characters, specially Spanish accents.
Read more >
Unicode HOWTO — Python 2.7.10 documentation
The Unicode Type¶ · errors argument specifies the response when the input string can't be converted according to the encoding's rules.
Read more >
Unicode HOWTO - Python 3.7.0a2 documentation
For example, you can't fit both the accented characters used in Western ... The errors parameter is the same as the parameter of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found