No, it is a bug in your code. PSGI spec requires you to encode the content body in bytestream.
Yes, because your code violates PSGI specification. Use
Middleware::Lint to catch such errors.
> my $app = sub {
> my $str = "Hello \x{263A}!";
> return [ 200, [ 'Content-Type' =>'text/plain' ], [ $str ] ];
> };
>
> what exactly is the right way to make this reach the browser without
> bombing out?
use Encode;
my $str = encode_utf8("Hello \x{263A}");
> On Oct 15, 11:22 am, Tatsuhiko Miyagawa <miyag...@gmail.com> wrote:
>> No, it is a bug in your code. PSGI spec requires you to encode the content
>> body in bytestream.
>>
--
Tatsuhiko Miyagawa
On Sat, Oct 16, 2010 at 10:49 AM, jbjbjb <justi...@gmail.com> wrote:
> thanks!
> my confusion stemmed from trying to fix it with decode ..
> as in, since the page has utf8 in it, I should "decode" it.
>
> However I now understand that encode_utf8 means "decode from possibly
> utf8, to a bytestream".
>
--
Tatsuhiko Miyagawa