You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Schindl <to...@bestsolution.at> on 2002/12/08 21:46:29 UTC

Problems with Apache::compat and german special chars

Problems with Apache::compat

CGI-PARAM-STRING: header=%DC%DC%DC%DC&body=%D6%D6%D6%D6&type=save_thread

------------------------cut--------------------------------------
[Sun Dec 08 21:39:09 2002] [error] [client 127.0.0.1] Character in "c"
format wrapped at
/usr/bestsolution/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/compat.pm line 217.
, referer: http://localhost/discussion-board
------------------------cut--------------------------------------

When I copy the lines of interest into a small perl program and execute
it, everything works perfectly. What's going wrong there?

------------------------cut--------------------------------------
map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split /[=&;]/,
$string, -1
------------------------cut--------------------------------------

thx

tom
-- 
b e s t s o l u t i o n . a t                        EDV Systemhaus GmbH
------------------------------------------------------------------------
Thomas Schindl            Project Management   mobile ++43/664/314 59 58
------------------------------------------------------------------------
Anton-Rauch-Str.6a        A-6020 Innsbruck     fax       ++43/512/935834
http://www.bestsolution.at                     phone     ++43/512/935834

Re: Problems with Apache::compat and german special chars

Posted by Tom Schindl <to...@gmx.at>.
I've found a work around for the problem. I have replaced
------------------------cut---------------------------
return map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split
/[=&;]/, $string, -1;
------------------------cut---------------------------
by
------------------------cut---------------------------
return map { s/%([0-9a-fA-F]{2})/chr(hex($1))/ge; $_; } split /[=&;]/,
$string, -1;
------------------------cut---------------------------

I don't know if pack has any advantages still I know that HTML::Entities
converts characters this way, so it should work in most situations.
Still does anybody know what's wrong with pack into mod_perl although it
works in perl itself without any problems.

I've also added a diff.

thx

tom

Am Son, 2002-12-08 um 21.46 schrieb Tom Schindl:
> Problems with Apache::compat
> 
> CGI-PARAM-STRING: header=%DC%DC%DC%DC&body=%D6%D6%D6%D6&type=save_thread
> 
> ------------------------cut--------------------------------------
> [Sun Dec 08 21:39:09 2002] [error] [client 127.0.0.1] Character in "c"
> format wrapped at
> /usr/bestsolution/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/compat.pm line 217.
> , referer: http://localhost/discussion-board
> ------------------------cut--------------------------------------
> 
> When I copy the lines of interest into a small perl program and execute
> it, everything works perfectly. What's going wrong there?
> 
> ------------------------cut--------------------------------------
> map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split /[=&;]/,
> $string, -1
> ------------------------cut--------------------------------------
> 
> thx
> 
> tom
-- 
Tom Schindl <to...@gmx.at>
bestsolution.at

Re: Problems with Apache::compat and german special chars

Posted by Tom Schindl <to...@bestsolution.at>.
Sorry here's the diff which includes one more thing:

When SUBMITING-Forms a whitespace(\s+) is replaced by +. We have to
retransform this.

tom

Am Son, 2002-12-08 um 22.39 schrieb Tom Schindl:
> I've found a work around for the problem, i would call it a patch
> because i don't know yet which side affects this replacement has. 
> 
> I have replaced
> ------------------------cut---------------------------
> return map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split
> /[=&;]/, $string, -1;
> ------------------------cut---------------------------
> by
> ------------------------cut---------------------------
> return map { s/%([0-9a-fA-F]{2})/chr(hex($1))/ge; $_; } split /[=&;]/,
> $string, -1;
> ------------------------cut---------------------------
> 
> I don't know if pack has any advantages still I know that HTML::Entities
> converts characters this way, so it should work in most situations.
> Still does anybody know what's wrong with pack into mod_perl although it
> works in perl itself without any problems.
> 
> I've also added a diff.
> 
> thx
> 
> tom
> 
> Am Son, 2002-12-08 um 21.46 schrieb Tom Schindl:
> > Problems with Apache::compat
> > 
> > CGI-PARAM-STRING: header=%DC%DC%DC%DC&body=%D6%D6%D6%D6&type=save_thread
> > 
> > ------------------------cut--------------------------------------
> > [Sun Dec 08 21:39:09 2002] [error] [client 127.0.0.1] Character in "c"
> > format wrapped at
> > /usr/bestsolution/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/compat.pm line 217.
> > , referer: http://localhost/discussion-board
> > ------------------------cut--------------------------------------
> > 
> > When I copy the lines of interest into a small perl program and execute
> > it, everything works perfectly. What's going wrong there?
> > 
> > ------------------------cut--------------------------------------
> > map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split /[=&;]/,
> > $string, -1
> > ------------------------cut--------------------------------------
> > 
> > thx
> > 
> > tom
-- 
Tom Schindl <to...@bestsolution.at>

Re: Problems with Apache::compat and german special chars

Posted by Tom Schindl <to...@bestsolution.at>.
I've found a work around for the problem, i would call it a patch
because i don't know yet which side affects this replacement has. 

I have replaced
------------------------cut---------------------------
return map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split
/[=&;]/, $string, -1;
------------------------cut---------------------------
by
------------------------cut---------------------------
return map { s/%([0-9a-fA-F]{2})/chr(hex($1))/ge; $_; } split /[=&;]/,
$string, -1;
------------------------cut---------------------------

I don't know if pack has any advantages still I know that HTML::Entities
converts characters this way, so it should work in most situations.
Still does anybody know what's wrong with pack into mod_perl although it
works in perl itself without any problems.

I've also added a diff.

thx

tom

Am Son, 2002-12-08 um 21.46 schrieb Tom Schindl:
> Problems with Apache::compat
> 
> CGI-PARAM-STRING: header=%DC%DC%DC%DC&body=%D6%D6%D6%D6&type=save_thread
> 
> ------------------------cut--------------------------------------
> [Sun Dec 08 21:39:09 2002] [error] [client 127.0.0.1] Character in "c"
> format wrapped at
> /usr/bestsolution/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/compat.pm line 217.
> , referer: http://localhost/discussion-board
> ------------------------cut--------------------------------------
> 
> When I copy the lines of interest into a small perl program and execute
> it, everything works perfectly. What's going wrong there?
> 
> ------------------------cut--------------------------------------
> map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split /[=&;]/,
> $string, -1
> ------------------------cut--------------------------------------
> 
> thx
> 
> tom
-- 
Tom Schindl <to...@bestsolution.at>

Re: Problems with Apache::compat and german special chars

Posted by Tom Schindl <to...@gmx.at>.
one more patch on Apache::compat. When SUBMITING-Forms a whitespace(\s+)
is replaced by +. We have to retransform this.



Am Son, 2002-12-08 um 21.46 schrieb Tom Schindl:
> Problems with Apache::compat
> 
> CGI-PARAM-STRING: header=%DC%DC%DC%DC&body=%D6%D6%D6%D6&type=save_thread
> 
> ------------------------cut--------------------------------------
> [Sun Dec 08 21:39:09 2002] [error] [client 127.0.0.1] Character in "c"
> format wrapped at
> /usr/bestsolution/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/Apache/compat.pm line 217.
> , referer: http://localhost/discussion-board
> ------------------------cut--------------------------------------
> 
> When I copy the lines of interest into a small perl program and execute
> it, everything works perfectly. What's going wrong there?
> 
> ------------------------cut--------------------------------------
> map { s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge; $_; } split /[=&;]/,
> $string, -1
> ------------------------cut--------------------------------------
> 
> thx
> 
> tom
-- 
Tom Schindl <to...@gmx.at>
bestsolution.at