diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-05 13:53:25 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-01-05 13:53:25 -0800 |
commit | c96a19984e27171ed75d3f76025cb8576b27f203 (patch) | |
tree | eb9fc75d4b783d7b8825022651923b5aed70ba30 | |
parent | 13b7548f0662b9d402ce0805fa452b28cde1d475 (diff) | |
download | ffi-yajl-c96a19984e27171ed75d3f76025cb8576b27f203.tar.gz |
fixes for 1.9 and 2.0lcg/fix-force-encoding
this is kind of shitty code, but once 2.0 and 1.9 are dropped and we
can use #scrub then all the shitty code can go away...
-rw-r--r-- | lib/ffi_yajl/encoder.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ffi_yajl/encoder.rb b/lib/ffi_yajl/encoder.rb index 59450b1..3b07e95 100644 --- a/lib/ffi_yajl/encoder.rb +++ b/lib/ffi_yajl/encoder.rb @@ -47,7 +47,7 @@ module FFI_Yajl if str.respond_to?(:scrub) str.scrub! else - str.encode!("UTF-8", undef: :replace, invalid: :replace) + str.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!('UTF-8') end end str @@ -68,7 +68,7 @@ module FFI_Yajl if token.respond_to?(:scrub) token.scrub! else - token.encode("utf-8", undef: :replace, invalid: :replace) + token.encode!("UTF-16le", undef: :replace, invalid: :replace).encode!('UTF-8') end case status when 1 # yajl_gen_keys_must_be_strings |