Created
March 21, 2012 12:05
JSON parse test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ jruby json_text.rb | |
["に到着を待っている"] is in encoding: UTF-8 | |
に到着を待っている is in encoding ASCII-8BIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ruby json_text.rb | |
["に到着を待っている"] is in encoding: UTF-8 | |
に到着を待っている is in encoding UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'json' | |
Encoding.default_internal = Encoding::UTF_8 | |
json_text = '["に到着を待っている"]' | |
puts "#{json_text} is in encoding: #{json_text.encoding}" | |
json_parsed = JSON.parse(json_text) | |
puts "#{json_parsed.first} is in encoding #{json_parsed.first.encoding}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment