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.

JSON cannot represent some naughty strings

See original GitHub issue

One of my favourite naughty strings is invalid utf-8 - for example, a bare \xff. It’s quite common to get 500s,etc on these as no-one ever bothers to check for unicode decoding errors. However, because JSON requires all strings to be valid utf-8, this example is only able to be included in the txt file.

Would this be something worth including and adding a special case in the script to omit from the json? Or is it too naughty for blns?

EDIT: This HN comment (https://news.ycombinator.com/item?id=10035738) suggested having the JSON file be of b64 encoded strings. This is a good suggestion, and allows arbitrary naughty bytes to be used, at the cost of readability.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jfinkhaeusercommented, Jan 2, 2016

Just so that’s clear, JSON does not require UTF-8 any longer, but valid unicode. The UTF-8 requirement is from an older version of JSON.

Doesn’t change much about this topic, but it’s worth noting.

0reactions
timmccommented, May 24, 2020

Given that some software environments conflate bytes and strings, or naively assume ASCII (or well-formed UTF-8, or whatever), I think it makes perfect sense to include byte sequences in here that cause decoding issues.

I don’t think that specifying an encoding is necessary, but having a comment explaining what the point of the byte sequence is would be useful—and that could mention the specific encoding that is being targeted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

minimaxir/big-list-of-naughty-strings - GitHub
The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input...
Read more >
Developers - JSON cannot represent some naughty strings -
JSON cannot represent some naughty strings ... One of my favourite naughty strings is invalid utf-8 - for example, a bare \xff ....
Read more >
Big List of Naughty Strings - Morioh
The Big List of Naughty Strings is a list of strings which have a high probability of causing issues when used as user-input...
Read more >
Big list of naughty strings. : r/programming - Reddit
tar files, just like any other data in a computer, is just a number; wether you represent is as binary/decimal/octal/hex/base-X is not relevant....
Read more >
How to fix "Incorrect string value" errors? - Stack Overflow
You can change the encoding to utf8mb4 for either a database or a table with only a few lines of SQL to fix...
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