Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Question about C:P:Unicode(::Encoding)

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


catalyst4 at augensalat

Oct 24, 2009, 1:26 PM

Post #1 of 7 (586 views)
Permalink
Question about C:P:Unicode(::Encoding)

These plugins hook into prepare_parameters() to decode data.

Why does it leave query_- and body_parameters untouched?

--
Bernhard Graf

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Oct 24, 2009, 1:55 PM

Post #2 of 7 (544 views)
Permalink
Re: Question about C:P:Unicode(::Encoding) [In reply to]

On Sat, Oct 24, 2009 at 1:26 PM, Bernhard Graf <catalyst4[at]augensalat.de>wrote:

> These plugins hook into prepare_parameters() to decode data.
>
> Why does it leave query_- and body_parameters untouched?
>

Always seemed like a bug to me.


http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/msg02350.html
http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/msg05312.html
http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/msg04321.html

I wonder about something like this, although might be cases where there's
something in there that should not be decoded.

after 'prepare_body_parameters' => sub {
my $c = shift;

my $v = Data::Visitor::Callback->new(
ignore_return_values => 1,
value => sub {
$_ = decode_utf8( $_, $CHECK ) unless Encode::is_utf8( $_ );
},
);

$v->visit( $c->req->body_parameters );

return;
};

Although I have cryptic notes elsewhere where I had problems with
Data::Visitor. Hum, should have taken better notes.






--
Bill Moseley
moseley[at]hank.org


bobtfish at bobtfish

Nov 4, 2009, 6:11 PM

Post #3 of 7 (444 views)
Permalink
Re: Question about C:P:Unicode(::Encoding) [In reply to]

> On Sat, Oct 24, 2009 at 1:26 PM, Bernhard Graf <catalyst4[at]augensalat.de
> > wrote:
> These plugins hook into prepare_parameters() to decode data.
>
> Why does it leave query_- and body_parameters untouched?
>
> Always seemed like a bug to me.

I agree.

I've also taken some of your other thoughts onboard.

I've just sent 0.5 to CPAN which corrects this issue.

Cheers
t0m


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Nov 4, 2009, 9:04 PM

Post #4 of 7 (440 views)
Permalink
Re: Question about C:P:Unicode(::Encoding) [In reply to]

On Wed, Nov 4, 2009 at 6:11 PM, Tomas Doran <bobtfish[at]bobtfish.net> wrote:

>
> On Sat, Oct 24, 2009 at 1:26 PM, Bernhard Graf <catalyst4[at]augensalat.de>
>> wrote:
>> These plugins hook into prepare_parameters() to decode data.
>>
>> Why does it leave query_- and body_parameters untouched?
>>
>> Always seemed like a bug to me.
>>
>
> I agree.
>
> I've also taken some of your other thoughts onboard.
>

> I've just sent 0.5 to CPAN which corrects this issue.
>

Great! And nice work on the upload file names.

I've been using Data::Visitor::Callback to decode the parameters. Not sure
if it's any better, but then the keys are decoded as well as values.

I've said this before, but I think this is something that Catalyst core
should handle, not left to a plugin.



--
Bill Moseley
moseley[at]hank.org


bobtfish at bobtfish

Nov 5, 2009, 1:24 PM

Post #5 of 7 (428 views)
Permalink
Re: Question about C:P:Unicode(::Encoding) [In reply to]

On 5 Nov 2009, at 05:04, Bill Moseley wrote:
> Great! And nice work on the upload file names.

For that, you can thank Masahiro Chiba, that part was his patch :)

> I've been using Data::Visitor::Callback to decode the parameters.
> Not sure if it's any better, but then the keys are decoded as well
> as values.

Hmm, I hadn't thought of the case where you'd want keys as uft8, but
that's perfectly valid.

I'd certainly take a patch to do that, but I'm afraid my enthusiasm
has vanished at the moment :)

> I've said this before, but I think this is something that Catalyst
> core should handle, not left to a plugin.

I'd probably agree with you, at least as a configurable parameter -
some of the things I'm doing now are really horribly breaking
abstraction to get things done..

Branch on 5.80 welcome, although we wouldn't want to change behavior
by default (at least any time soon, or only for new apps)..

Cheers
t0m


_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Nov 5, 2009, 1:31 PM

Post #6 of 7 (429 views)
Permalink
Re: Question about C:P:Unicode(::Encoding) [In reply to]

On Thu, Nov 5, 2009 at 1:24 PM, Tomas Doran <bobtfish[at]bobtfish.net> wrote:

>
>
> I've said this before, but I think this is something that Catalyst core
>> should handle, not left to a plugin.
>>
>
> I'd probably agree with you, at least as a configurable parameter - some of
> the things I'm doing now are really horribly breaking abstraction to get
> things done..
>

In general, I think the right place to do the decoding is as close to the
"edge" of the program as possible. That might mean HTTP::Body -- or in the
Engine code for query params. But, I haven't looked at it. Where do you
think that "edge" would be?


--
Bill Moseley
moseley[at]hank.org


bobtfish at bobtfish

Nov 5, 2009, 2:25 PM

Post #7 of 7 (424 views)
Permalink
Re: Question about C:P:Unicode(::Encoding) [In reply to]

On 5 Nov 2009, at 21:31, Bill Moseley wrote:
> In general, I think the right place to do the decoding is as close
> to the "edge" of the program as possible. That might mean
> HTTP::Body -- or in the Engine code for query params. But, I
> haven't looked at it. Where do you think that "edge" would be?

Yes.

Having not thought about it too hard, I'd say the engine code +
Catalyst::Request::Upload + probably HTTP::Body are the right places :)

Cheers
t0m

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.