Remove unnecessary special character #61
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As I was working on a project, this error was thrown at me:
It only occured when I was using the production build, as the Javascript Bundler I used (webpack) came with a dev-server that for some reason did not throw this error.
Upon closer inspecting of the line that this "unexpected" token is found, I found the sourcecode of this project:
After being extremely confused about this for a few days, I searched through all the code in my dependencies for that dreaded  character. I did not find it. So I searched for all the various bits of code I saw around this broken character, which led me to the function in this Pull Request.
You see when you just use this function in a UTF-8 environment, it all works fine. You wouldn't even notice it. But I forgot the meta "charset" html tag on my project, as this was very early in development and this error had me stumped. This omitted tag made the character set default to ISO-8859-1 (which would've caused other problems too I'm sure) and turns this innocent "no-breaking space" into " Â", breaking any interpreter.
This proposed change removes this character and replaces it with a space, to save someone elses sanity.
Edit: Oh, of course. This project is abandoned. Oh well, maybe some unfortunate soul will find this PR and it may help them.