Encode utf8 string into utf16 #67

Open
wants to merge 39 commits into
from

Conversation

Projects
None yet
3 participants

likema commented Jan 7, 2012

To be conformed with 6. Source Text in Standard ECMA-262 5.1 Edition, encode utf8 string into utf16. This will be JSON to be displayed correctly in web browser no matter what the encoding of browser is.

For example, encode UTF8 Chinese words "你好,世界!" (means "Hello World!")

"\u4f60\u597d\uff0c\u4e16\u754c\uff01"

bpowers and others added some commits Oct 4, 2011

encode: use an on-stack buffer for 2-char escape sequences
When profiling my application, this sped up yajl_string_encode by
3.9%.
encode: don't check specific cases when the current char is large
Most characters don't get escaped.  According to the RFC, the only
character greater than '/' that gets escaped is '/'. Test for this
common case first, and only if the char is a candidate for escaping
check for the other escape cases.

This cuts an additional 29% off the runtime of yajl_string_encode
augment in-tree performance benchmark to assess serialization perform…
…ance as well as parsing performance. (provides a means to assess issue #59)
Merge branch 'master' into 2.1.0
Conflicts:
	CMakeLists.txt
	ChangeLog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment