ruby/psych

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

scivola opened this issue · 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!