reactjs / react-tutorial

Code from the React tutorial.
http://facebook.github.io/react/docs/tutorial.html
Other
3.29k stars 2.13k forks source link

Ensure we are using utf-8 for file IO #81

Closed gerrywastaken closed 9 years ago

gerrywastaken commented 9 years ago

Without this on a system that does not have utf-8 as the default (e.g. the latest https://hub.docker.com/_/ruby/), the user will hit an error as soon as JSON.parse() gets to the apostrophe in the example.json.

ERROR Encoding::InvalidByteSequenceError: "\xE2" on US-ASCII

This fix makes sure that when we do File.read() it is going to return utf-8 by default, which is what the script was originally expecting.

facebook-github-bot commented 9 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

gerrywastaken commented 9 years ago

Hmmmm...

These changes are my own work. I release all ownership of them.

I will not be signing this CLA. Without legal advice I can not be sure of the consequences, especially given the CLA is not just limited to this commit, but anything I ever "submit" to "Facebook Inc".

zpao commented 9 years ago

Thanks for bringing it up.

Legal stuff is never fun so I won't blame you for not signing. I ended up just writing it in a different way: 6647f84311c47450a0940a88dea1b06484b0a543

gerrywastaken commented 9 years ago

Thanks for that :)