Project

General

Profile

Bug #6566

JSON.dump can generate invalid UTF-8 sequence

Added by shyouhei (Shyouhei Urabe) about 8 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
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

Also available in: Atom PDF