mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 10:33:58 +02:00
merge revision(s) 50339,50340,50342,50343: [Backport #10705]
parser.rl: use StringValue * ext/json/parser/parser.rl (cParser_initialize): use StringValue instead of direct rb_convert_type and remove duplicate conversion. * ext/json/parser/parser.rl: raise with messages in UTF-8 encoding. [ruby-core:67386] [Bug #10705] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c03800575
commit
4fe4f46592
6 changed files with 186 additions and 137 deletions
|
@ -544,4 +544,14 @@ EOT
|
|||
JSON::Parser.new(source)
|
||||
assert_equal Encoding::ASCII_8BIT, source.encoding
|
||||
end if defined?(Encoding::ASCII_8BIT)
|
||||
|
||||
def test_error_message_encoding
|
||||
bug10705 = '[ruby-core:67386] [Bug #10705]'
|
||||
json = "\"\xE2\x88\x9A\"".force_encoding(Encoding::UTF_8)
|
||||
e = assert_raise(JSON::ParserError) {
|
||||
JSON.parse(json)
|
||||
}
|
||||
assert_equal(Encoding::UTF_8, e.message.encoding, bug10705)
|
||||
assert_include(e.message, json, bug10705)
|
||||
end if defined?(Encoding::UTF_8)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue