From: Aaron Patterson Date: 2010-06-02T09:24:00+09:00 Subject: Re: 1.9.3 Encoding Error w/ compressed data http request header --jI8keyz6grp/JLjh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, May 30, 2010 at 12:40:16AM +0900, Doug Livesey wrote: > Hi -- it's possible that I'm getting all of this *entirely* wrong, so I > thought I'd post what I'm trying to do here & see what comes back. > Basically, I have a RoR web service that has bulk_create and bulk_update > methods in one of its controllers. > These take ActiveResource-style JSON hashes of potentially many objects > to create or update. > The service is JSON, so what I've been doing is using HTTParty to send > the post and put requests to the service url with the objects data to be > created or updated in the query string. > Naturally, I quickly ran into issues with the amount of data that I > could send that way, so I added compression with Zlib to the service, > and to the client calling it. > The client code, for example, looks a little like this: >=20 > My::Service( :put, "/objects/bulk_create.json", query: { objects_doc: > Zlib::Deflate.deflate( objects.to_json ) } ) >=20 > This fixed the issue. > However, I'm now updating the service to run on Ruby 1.9.3, and am > running into encoding issues (apparently the bane of many a Ruby coder's > life at the moment, although I'm only upgrading from 1.9.1). > The error I'm actually getting is this: "invalid byte sequence in UTF-8 > (ArgumentError)" > So I guess I have two questions: > 1) How can I fix this so that it works again? > 2) *Should* I fix it, or is there another way that I should be sending > data to my web service? Can you reduce the problem to code the breaks outside of your particular application? This sounds like something that *should* work, but it's difficult for people to help if they can't reproduce the problem. --=20 Aaron Patterson http://tenderlovemaking.com/ --jI8keyz6grp/JLjh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iQEcBAEBAgAGBQJMBaR+AAoJEJUxcLy0/6/G67QH+wafdvRP9rbY06sOJfbvENBW joPSObw8RfjXw9rZ+zQioY0qsR7Ursvcx3vzeTYU7OJ1QbRgRNK2pgIlx678zd0q 0GysgDGRqKumyEus1aN3N2WuH6yLVyTnTPTHLgsavp7dBQo33zMRsQNw53Fqm4BX K5RgAbCMNgc2d55O9nKUaGAb8x4dfV0PSwGamsJ/AU6ngOTzeQ+LOFHdiGVUJC5U JNT48AZiNRHkIAqcEIaIT7I4Y0wpqm4ce4xTf3YPc2otsy9M/Y0ExwYtxVaF264U 5qv9PJaHW3R+SVxohDGwwWmexwzRH5A9JCv+2iR09JcsmiYdSteUXrxwUyY1maU= =Y60w -----END PGP SIGNATURE----- --jI8keyz6grp/JLjh--