зеркало из https://github.com/github/ruby.git
* ext/json/lib/json/pure/generator.rb (utf8_to_json):
force_encoding before gsub. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
6d58b1e54f
Коммит
84f677d2f3
|
@ -1,3 +1,8 @@
|
|||
Tue Oct 7 16:43:51 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/json/lib/json/pure/generator.rb (utf8_to_json):
|
||||
force_encoding before gsub.
|
||||
|
||||
Tue Oct 7 16:35:41 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* ext/json/lib/json/pure/generator.rb (utf8_to_json):
|
||||
|
|
|
@ -40,8 +40,8 @@ module JSON
|
|||
# Convert a UTF8 encoded Ruby string _string_ to a JSON string, encoded with
|
||||
# UTF16 big endian characters as \u????, and return it.
|
||||
def utf8_to_json(string) # :nodoc:
|
||||
string = string.gsub(/["\\\/\x0-\x1f]/) { MAP[$&] }
|
||||
string.force_encoding(Encoding::ASCII_8BIT)
|
||||
string = string.dup.force_encoding(Encoding::ASCII_8BIT)
|
||||
string.gsub!(/["\\\/\x0-\x1f]/) { MAP[$&] }
|
||||
string.gsub!(/(
|
||||
(?:
|
||||
[\xc2-\xdf][\x80-\xbf] |
|
||||
|
|
Загрузка…
Ссылка в новой задаче