Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Syntax error with special whitespace characters #42

Closed
joeheyming opened this issue Nov 14, 2017 · 1 comment · Fixed by #43
Closed

Syntax error with special whitespace characters #42

joeheyming opened this issue Nov 14, 2017 · 1 comment · Fixed by #43

Comments

@joeheyming
Copy link
Contributor

I was trying to load a text file that was written with Google Docs. It had issues like the character for " was the special “.

But that was not my issue.
It turns out that a special whitespace character was put in the file. I used String.charCodeAt to find out the whitespace was of code: 8232 or

U+2028 | line separator

I replaced all these characters and the raw-loader now works.
I'm filing this issue because I think that there needs to be some pre-processing to replace or correctly JSON stringify these characters.

@joeheyming
Copy link
Contributor Author

actually this works:

var stringified = JSON.stringify(content)
.replace(/\u2028/g, '\u2028')
.replace(/\u2029/g, '\u2029');

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant