Commit 494f33d06cabc335c2bf9d63dfd555ed82cbaad0

Now the forceful change of encoding (to UTF-8) is only performed if the normal .to_json fails. Better and ster.

Commit diff

lib/couch_object/persistable.rb

 
698698
699699 parameters["belongs_to"] = @belongs_to if @couch_initial_load && @belongs_to
700700
701 # In case the user wants to save some funky strings we have to decode
702 # them first.
703 CouchObject::Utils::decode_strings(parameters).to_json
704
701 begin
702 parameters.to_json
703 rescue JSON::GeneratorError
704 # All strings aren't encoded properly, so we have to force them into
705 # UTF-8.
706 # FIXME: The kconv library has some weird artefacts though where
707 # a lot of Norwegian (Scandianavian?) letters get turned into
708 # asian characters of some sort!
709 CouchObject::Utils::decode_strings(parameters).to_json
710 end
711
705712 end
706713
707714
toggle raw diff