summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Frank <flori@ping.de>2013-02-22 03:10:36 +0100
committerFlorian Frank <flori@ping.de>2013-02-22 03:10:36 +0100
commit4d77909d2d482670a455fff45215d5858cd6d87f (patch)
tree98172513a4642b0fc313c9806f986aa7e8299ea5
parenta1f8f1487e1f37a78e775354d17b24a288ab8cbd (diff)
downloadjson-4d77909d2d482670a455fff45215d5858cd6d87f.tar.gz
Fix regex encoding problem on ruby-head, ouch
-rw-r--r--json.gemspec2
-rw-r--r--json_pure.gemspec2
-rw-r--r--lib/json/pure/generator.rb18
3 files changed, 11 insertions, 11 deletions
diff --git a/json.gemspec b/json.gemspec
index cbe6440..d3c0489 100644
--- a/json.gemspec
+++ b/json.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Florian Frank"]
- s.date = "2013-02-20"
+ s.date = "2013-02-22"
s.description = "This is a JSON implementation as a Ruby extension in C."
s.email = "flori@ping.de"
s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb"]
diff --git a/json_pure.gemspec b/json_pure.gemspec
index 3ddcc16..d4a8433 100644
--- a/json_pure.gemspec
+++ b/json_pure.gemspec
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Florian Frank"]
- s.date = "2013-02-20"
+ s.date = "2013-02-22"
s.description = "This is a JSON implementation in pure Ruby."
s.email = "flori@ping.de"
s.extra_rdoc_files = ["README.rdoc"]
diff --git a/lib/json/pure/generator.rb b/lib/json/pure/generator.rb
index 59e2245..b6cf5e5 100644
--- a/lib/json/pure/generator.rb
+++ b/lib/json/pure/generator.rb
@@ -103,15 +103,15 @@ module JSON
def valid_utf8?(string)
string =~
- /\A( [\x09\x0A\x0D\x20-\x7E] # ASCII
- | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte
- | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs
- | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte
- | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates
- | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3
- | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15
- | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16
- )*\z/x
+ /\A( [\x09\x0a\x0d\x20-\x7e] # ASCII
+ | [\xc2-\xdf][\x80-\xbf] # non-overlong 2-byte
+ | \xe0[\xa0-\xbf][\x80-\xbf] # excluding overlongs
+ | [\xe1-\xec\xee\xef][\x80-\xbf]{2} # straight 3-byte
+ | \xed[\x80-\x9f][\x80-\xbf] # excluding surrogates
+ | \xf0[\x90-\xbf][\x80-\xbf]{2} # planes 1-3
+ | [\xf1-\xf3][\x80-\xbf]{3} # planes 4-15
+ | \xf4[\x80-\x8f][\x80-\xbf]{2} # plane 16
+ )*\z/nx
end
end
module_function :utf8_to_json, :utf8_to_json_ascii, :valid_utf8?