From 7f05140864938a1c3462cb5513602ac7c4c50ac3 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 12 Jan 2017 12:21:55 +0100 Subject: Fix conversion crash on 1.9 --- .travis.yml | 4 ++++ Rakefile | 4 ++-- ext/json/ext/parser/parser.c | 2 +- ext/json/ext/parser/parser.rl | 2 +- json.gemspec | Bin 5974 -> 5908 bytes json_pure.gemspec | 3 +-- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28e6b65..e74e4a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ language: ruby # Specify which ruby versions you wish to run your tests on, each version will be used rvm: + - 1.8.7 + - 1.9.1 + - 1.9.2 + - 1.9.3 - 2.0.0 - 2.1 - 2.2 diff --git a/Rakefile b/Rakefile index f581740..19324a7 100644 --- a/Rakefile +++ b/Rakefile @@ -95,7 +95,7 @@ if defined?(Gem) and defined?(Gem::PackageTask) s.email = "flori@ping.de" s.homepage = "http://flori.github.com/#{PKG_NAME}" s.license = 'Ruby' - s.required_ruby_version = '~>2.0' + #s.required_ruby_version = '~>2.0' end desc 'Creates a json_pure.gemspec file' @@ -133,7 +133,7 @@ if defined?(Gem) and defined?(Gem::PackageTask) s.email = "flori@ping.de" s.homepage = "http://flori.github.com/#{PKG_NAME}" s.license = 'Ruby' - s.required_ruby_version = '~>2.0' + #s.required_ruby_version = '~>2.0' end desc 'Creates a json.gemspec file' diff --git a/ext/json/ext/parser/parser.c b/ext/json/ext/parser/parser.c index 592e729..4ac0c87 100644 --- a/ext/json/ext/parser/parser.c +++ b/ext/json/ext/parser/parser.c @@ -1608,7 +1608,7 @@ static VALUE convert_encoding(VALUE source) FORCE_UTF8(source); } } else { - source = rb_str_conv_enc(source, NULL, rb_utf8_encoding()); + source = rb_str_conv_enc(source, rb_enc_get(source), rb_utf8_encoding()); } } #else diff --git a/ext/json/ext/parser/parser.rl b/ext/json/ext/parser/parser.rl index 2fa0cae..4fee7ed 100644 --- a/ext/json/ext/parser/parser.rl +++ b/ext/json/ext/parser/parser.rl @@ -592,7 +592,7 @@ static VALUE convert_encoding(VALUE source) FORCE_UTF8(source); } } else { - source = rb_str_conv_enc(source, NULL, rb_utf8_encoding()); + source = rb_str_conv_enc(source, rb_enc_get(source), rb_utf8_encoding()); } } #else diff --git a/json.gemspec b/json.gemspec index d7a396a..635c91a 100644 Binary files a/json.gemspec and b/json.gemspec differ diff --git a/json_pure.gemspec b/json_pure.gemspec index 1aa6360..d261c47 100644 --- a/json_pure.gemspec +++ b/json_pure.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Florian Frank".freeze] - s.date = "2017-01-11" + s.date = "2017-01-12" s.description = "This is a JSON implementation in pure Ruby.".freeze s.email = "flori@ping.de".freeze s.extra_rdoc_files = ["README.md".freeze] @@ -16,7 +16,6 @@ Gem::Specification.new do |s| s.homepage = "http://flori.github.com/json".freeze s.licenses = ["Ruby".freeze] s.rdoc_options = ["--title".freeze, "JSON implemention for ruby".freeze, "--main".freeze, "README.md".freeze] - s.required_ruby_version = Gem::Requirement.new("~> 2.0".freeze) s.rubygems_version = "2.6.8".freeze s.summary = "JSON Implementation for Ruby".freeze s.test_files = ["./tests/test_json.rb".freeze, "./tests/test_json_addition.rb".freeze, "./tests/test_json_encoding.rb".freeze, "./tests/test_json_fixtures.rb".freeze, "./tests/test_json_generate.rb".freeze, "./tests/test_json_generic_object.rb".freeze, "./tests/test_json_string_matching.rb".freeze, "./tests/test_json_unicode.rb".freeze] -- cgit v1.2.1