From 7f05140864938a1c3462cb5513602ac7c4c50ac3 Mon Sep 17 00:00:00 2001 From: Florian Frank Date: Thu, 12 Jan 2017 12:21:55 +0100 Subject: [PATCH] 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 28e6b657..e74e4a4f 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 f5817409..19324a72 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 592e729e..4ac0c878 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 2fa0caee..4fee7ed6 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 d7a396a2f08d0bba22ab8e2a944be68b2f1ee17e..635c91a1e16eb6074ffaecfcc3f37ca41b7d62c7 100644 GIT binary patch delta 19 bcmcbnH$`v5CPqf1&6^pQ3vQkxyo(tCP!|WA delta 51 zcmbQDcTI1@CPqfX&6^pQ3-Y8EmSz^Ero= 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]