Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Unicode-Encoding CPAN distribution.

Report information
The Basics
Id: 60247
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-Unicode-Encoding

People
Owner: bobtfish [...] bobtfish.net
Requestors: abryan+bc [...] pangeamedia.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.1
Fixed in: (no value)



Subject: Support missing content types: i.e. JSON
The MIME type for JSON is application/json, which doesn't get identified as text by the regexp in this module. It would be nice to have to have the ability to override or add to the regexp through a config option.. or at the very least add json$ to the regexp! $c->response->content_type =~ /^text|xml$|javascript$|json$/; -- Andrew Bryan abryan+bc@pangeamedia.com
You should be generating JSON using a JSON module / view, which should perform the encoding itself, therefore the unicode plugin should not need to run. Can you give me some more details about what you're doing / why you need the encoding step for JSON output? However, a patch to make the set of content types configurable would be very welcome.
That's true.. hmmm I'm using JSON::XS and for some reason my encoded output seems to contain wide chars even though utf8 mode is enabled. I might play with it some more, or perhaps I'm reading the documentation incorrectly. Regardless, I still feel this module should explicitly encode JSON if only for consistency. You might, for example, output some JSON that is not created by an encoder. On Wed Aug 11 10:52:18 2010, BOBTFISH wrote: Show quoted text
> You should be generating JSON using a JSON module / view, which should > perform the encoding itself, therefore the unicode plugin should not > need to run. > > Can you give me some more details about what you're doing / why you need > the encoding step for JSON output? > > However, a patch to make the set of content types configurable would be > very welcome.
-- Andrew Bryan abryan+bc@pangeamedia.com
On Wed Aug 11 11:18:38 2010, abryan17 wrote: Show quoted text
> That's true.. hmmm I'm using JSON::XS and for some reason my encoded > output seems to contain wide chars even though utf8 mode is enabled. I > might play with it some more, or perhaps I'm reading the documentation > incorrectly.
Can you show me a Devel::Peek::Dump of what JSON::XS is outputting for a trivial case? And what deployment environment are you using / how does your issue manifest? Show quoted text
> Regardless, I still feel this module should explicitly encode JSON if > only for consistency. You might, for example, output some JSON that is > not created by an encoder.
Because everyone like double encoding? :) Being serious, if you're outputting JSON manually, then you're doing it wrong, and I'm happy for the encoding to be broken in that case... Cheers t0m
Ah.. JSON::XS in View was outputting correctly, but there a useless utf8::decode being applied somewhere before the output was finalized. Once that was removed everything works correctly. I guess changing the regex might not be a much needed feature after all... thanks for humoring me anyway... -- Andrew Bryan abryan+bc@pangeamedia.com
On Wed Aug 11 11:49:37 2010, abryan17 wrote: Show quoted text
> Ah.. JSON::XS in View was outputting correctly, but there a useless > utf8::decode being applied somewhere before the output was finalized. > Once that was removed everything works correctly.
Great! Show quoted text
> I guess changing the regex might not be a much needed feature after > all... thanks for humoring me anyway...
I still think it's entirely worthwhile, and I'd still take a patch to do so :) But I'm assuming you're happy now your problem is solved, so I'll resolve this. Cheers t0m