So I am successfully parsing frontmatter with
YAML.load_file(stringForFilePath, permitted_classes: ['Date'])
on a whole bunch of files except on a single file I get this error:
control characters are not allowed at line 1 column 1 (Psych::SyntaxError)
Things I have tried:
- Putting the frontmatter / YAML in a validator to check for errors
- Deleting the entire frontmatter and put in a basic stub in its place.
- Checked the file encoding (UTF-8 same as other files that are working)
- Checked the line endings (CLRF same as other files that are working)
- Removing every non-ASCII character from the file (e.g. the HTML, there was none in frontmatter)
Problem was with a non-printing/invisible control character in my HTML body that was very hard to track down. Some 3rd party tools I tried didn't pick it up and it wasn't until I updated my text editor was I finally able to find it.