psych icon indicating copy to clipboard operation
psych copied to clipboard

Wrong location displayed in the error message caused by a control character

Open scivola opened this issue 4 years ago • 0 comments

Reproduciton code:

require "yaml"
YAML.load %(foo:\n  - "x\u000Cy")

The above YAML text has a control character U+000C, which is not allowed. The code gives the following error message:

(<unknown>): control characters are not allowed at line 1 column 1 (Psych::SyntaxError)

Though the character is at line 2 column 7, the reported location is line 1 column 1. It confuses us.

If it is very difficult to display the correct location, I think it is better to display somewhere!

scivola avatar Jul 08 '21 12:07 scivola