Project

General

Profile

Actions

Bug #6566

closed

JSON.dump can generate invalid UTF-8 sequence

Added by shyouhei (Shyouhei Urabe) almost 12 years ago. Updated over 4 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-06-09) [x86_64-linux]
[ruby-core:45535]

Description

=begin
Look, in the following code JSON.dump outputs a sequence invalid as UTF-8.

-- encoding: utf-8 --

require 'json'
IO.popen('hexdump -C', 'w') do |fp|
JSON.dump(["\xea"], fp)
end

RFC4627 says that to encode JSON as a Unicode is a "SHALL". So this is an RFC violation.

=end


Files

bug-6566.diff (1.62 KB) bug-6566.diff reject invalid UTF-8 sequence in JSON.generate nobu (Nobuyoshi Nakada), 06/10/2012 07:19 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0