From: "shyouhei (Shyouhei Urabe)" Date: 2012-06-10T02:48:24+09:00 Subject: [ruby-core:45535] [ruby-trunk - Bug #6566][Assigned] JSON.dump can generate invalid UTF-8 sequence Issue #6566 has been reported by shyouhei (Shyouhei Urabe). ---------------------------------------- Bug #6566: JSON.dump can generate invalid UTF-8 sequence https://bugs.ruby-lang.org/issues/6566 Author: shyouhei (Shyouhei Urabe) Status: Assigned Priority: Normal Assignee: naruse (Yui NARUSE) Category: M17N Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-06-09) [x86_64-linux] =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 -- http://bugs.ruby-lang.org/