This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* encode to handle invalid UTF | |
* | |
* If Chrome tells you "Could not decode a text frame as UTF-8" when you try sending | |
* data from nodejs, try using these functions to encode/decode your JSON objects. | |
* | |
* see discussion here: http://code.google.com/p/v8/issues/detail?id=761#c8 | |
* see also, for browsers that don't have native JSON: https://github.com/douglascrockford/JSON-js | |
* | |
* Any time you need to send data between client and server (or vice versa), encode before sending, |