lib/json/editor.rb in json_pure-1.4.6 vs lib/json/editor.rb in json_pure-1.5.0
- old
+ new
@@ -1,10 +1,9 @@
# To use the GUI JSON editor, start the edit_json.rb executable script. It
# requires ruby-gtk to be installed.
require 'gtk2'
-require 'iconv'
require 'json'
require 'rbconfig'
require 'open-uri'
module JSON
@@ -1270,11 +1269,10 @@
end
def parse_json(json)
check_pretty_printed(json)
if @encoding && !/^utf8$/i.match(@encoding)
- iconverter = Iconv.new('utf8', @encoding)
- json = iconverter.iconv(json)
+ json = JSON.iconv 'utf-8', @encoding, json
end
JSON::parse(json, :max_nesting => false, :create_additions => false)
end
private :parse_json