From 5ba9427f34800591cb45eb34403c71e2e65fd122 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Thu, 23 Apr 2015 17:21:31 -0700 Subject: change :validate_utf8=false to still emit utf8 validate_utf8=true raises on bad input validate_utf8=false now does not raise, but still produces valid UTF-8 clean JSON by replacing characters. the previous behavior of emitting bad JSON that was not UTF-8 clean when validate_utf8 was false is dropped (and this was behavior only of the C extension and not the ffi extension since the ffi layer must do some scrubbing of its own). --- spec/ffi_yajl/encoder_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'spec') diff --git a/spec/ffi_yajl/encoder_spec.rb b/spec/ffi_yajl/encoder_spec.rb index 5691bf6..7dbe4d0 100644 --- a/spec/ffi_yajl/encoder_spec.rb +++ b/spec/ffi_yajl/encoder_spec.rb @@ -196,6 +196,10 @@ describe "FFI_Yajl::Encoder" do it "does not raise an error" do expect{ encoder.encode(ruby) }.not_to raise_error end + + it "returns valid utf8" do + expect( encoder.encode(ruby).valid_encoding? ).to be true + end end end end -- cgit v1.2.1