Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge https://github.com/sspinc/crack into sspinc-9cb9d64285e3c6d33946

Conflicts:
	Rakefile
	lib/crack/json.rb
  • Loading branch information...
commit bc1e4486c36c0754132648d2766992b2cfdc4efd 2 parents 3171e3c + 510f25d
John Nunemaker authored
Showing with 7 additions and 1 deletion.
  1. +3 −1 Rakefile
  2. +4 −0 lib/crack/json.rb
4 Rakefile
View
@@ -1,7 +1,9 @@
$:.unshift("lib")
require 'rubygems'
require 'rake'
-require File.expand_path('../lib/crack', __FILE__)
+
+$:.unshift(File.expand_path('lib', File.dirname(__FILE__)))
+require 'crack'
begin
require 'jeweler'
4 lib/crack/json.rb
View
@@ -16,6 +16,10 @@ def self.parse(json)
protected
def self.unescape(str)
+ # Force the encoding to be UTF-8 so we can perform regular expressions
+ # on 1.9.2 without blowing up.
+ # see http://stackoverflow.com/questions/1224204/ruby-mechanize-getting-force-encoding-exception for a similar issue
+ str.force_encoding('UTF-8') if defined?(Encoding) && str.respond_to?(:force_encoding)
str.gsub(/\\u0000/, "").gsub(/\\u([0-9a-f]{4})/) { [$1.hex].pack("U") }
end
Please sign in to comment.
Something went wrong with that request. Please try again.