1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/json/lib/json/pure/generator.rb (utf8_to_json):

downcase the result of Unicode escape.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-10-07 07:37:23 +00:00
parent ddf88ea80b
commit 6d58b1e54f
3 changed files with 9 additions and 4 deletions

View file

@ -52,7 +52,7 @@ module JSON
)/nx) { |c|
c.size == 1 and raise GeneratorError, "invalid utf8 byte: '#{c}'"
c = c.unpack("U*")[0]
c > 0xFFFF ? ('\uD%03X\uD%03X' % [0x7C0+c/1024, 0xC00+c%1024]) : ('\u%04X'%c)
c > 0xFFFF ? ('\ud%03x\ud%03x' % [0x7C0+c/1024, 0xC00+c%1024]) : ('\u%04x'%c)
}
string
end