Update vendored OkJson

This commit is contained in:
Jack Nagel 2014-02-10 13:17:16 -05:00
parent 1eddc73472
commit b754ad0d0b

View File

@ -29,7 +29,7 @@ require 'stringio'
# http://golang.org/src/pkg/utf8/utf8.go # http://golang.org/src/pkg/utf8/utf8.go
module Vendor module Vendor
module OkJson module OkJson
Upstream = '42' Upstream = '43'
extend self extend self
@ -462,11 +462,16 @@ module Vendor
# In ruby >= 1.9, s[r] is a codepoint, not a byte. # In ruby >= 1.9, s[r] is a codepoint, not a byte.
if rubydoesenc? if rubydoesenc?
begin begin
c.ord # will raise an error if c is invalid UTF-8 # c.ord will raise an error if c is invalid UTF-8
if c.ord < Spc.ord
c = "\\u%04x" % [c.ord]
end
t.write(c) t.write(c)
rescue rescue
t.write(Ustrerr) t.write(Ustrerr)
end end
elsif c < Spc
t.write("\\u%04x" % c)
elsif Spc <= c && c <= ?~ elsif Spc <= c && c <= ?~
t.putc(c) t.putc(c)
else else