Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CGI::Util::escape broken for iso-8859-1 data #9164

Closed
p5pRT opened this issue Dec 23, 2007 · 5 comments
Closed

CGI::Util::escape broken for iso-8859-1 data #9164

p5pRT opened this issue Dec 23, 2007 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 23, 2007

Migrated from rt.perl.org#49055 (status was 'resolved')

Searchable as RT49055$

@p5pRT
Copy link
Author

p5pRT commented Dec 23, 2007

From srezic@cpan.org

This is a bug report for perl from srezic@​cpan.org,
generated with the help of perlbug 1.36 running under perl 5.10.0.


There's a change in behaviour when passing characters with codepoints
160..255 to CGI.pm​:

$ perl5.8.8 -MCGI -e 'warn CGI->new({a=>"\xe4\xf6\xfc"})->query_string'
a=%E4%F6%FC at -e line 1.
(This is with CGI​::Util 1.5)

$ perl5.10.0 -MCGI -e 'warn CGI->new({a=>"\xe4\xf6\xfc"})->query_string'
a=%C3%A4%C3%B6%C3%BC at -e line 1.
(This is with CGI​::Util 1.5_01)

I don't see a possibility to get iso-8859-1-encoded data with current
perl & CGI when using this method. Probably there should be some kind
of global flag which controls the encoding of the data.

Regards,
  Slaven



Flags​:
  category=library
  severity=high


Site configuration information for perl 5.10.0​:

Configured by eserte at Tue Dec 18 20​:30​:25 CET 2007.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration​:
  Platform​:
  osname=freebsd, osvers=6.2-release, archname=amd64-freebsd
  uname='freebsd biokovo-amd64.herceg.de 6.2-release freebsd 6.2-release #0​: fri jan 12 08​:32​:24 utc 2007 root@​portnoy.cse.buffalo.edu​:usrobjusrsrcsysgeneric amd64 '
  config_args='-Dprefix=/usr/perl5.10.0 -Dusemymalloc=n -D cc=ccache cc -Dgccansipedantic -de'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='ccache cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include',
  optimize='-O2 -pipe',
  cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -I/usr/local/include'
  ccversion='', gccversion='3.4.6 [FreeBSD] 20060305', gccosandvers=''
  intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='ccache cc', ldflags ='-Wl,-E -L/usr/local/lib'
  libpth=/usr/lib /usr/local/lib
  libs=-lgdbm -lm -lcrypt -lutil -lc
  perllibs=-lm -lcrypt -lutil -lc
  libc=, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
  cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib'

Locally applied patches​:
 


@​INC for perl 5.10.0​:
  /usr/perl5.10.0/lib/5.10.0/amd64-freebsd
  /usr/perl5.10.0/lib/5.10.0
  /usr/perl5.10.0/lib/site_perl/5.10.0/amd64-freebsd
  /usr/perl5.10.0/lib/site_perl/5.10.0
  .


Environment for perl 5.10.0​:
  HOME=/home/e/eserte
  LANG (unset)
  LANGUAGE (unset)
  LC_ALL=de_DE.ISO8859-1
  LC_CTYPE=de_DE.ISO8859-1
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/X11R6/bin​:/usr/X11/bin​:/usr/local/bin​:/usr/bin​:/bin​:/usr/gnu/bin​:/usr/TeX/bin​:/usr/local/sbin​:/usr/sbin​:/sbin​:/usr/local/pilot/bin​:/home/e/eserte/bin/FreeBSD​:/home/e/eserte/bin/sh​:/home/e/eserte/bin​:/usr/X386/bin​:/usr/games​:/home/e/eserte/devel
  PERL_BADLANG (unset)
  PERL_HTML_DISPLAY_CLASS=HTML​::Display​::Mozilla
  SHELL=/bin/tcsh

@p5pRT
Copy link
Author

p5pRT commented Dec 24, 2007

From @avar

The pack format changed from C* to U0C*, this can be reduced to the following​:

$ perl -mCGI​::Util -le 'my @​str; push @​str, pack("C*", unpack($_, "\xe4\xf6\xfc")) for qw(C* U0C*); for (@​str) { s/([^a-zA-Z0-9_.~-])/uc sprintf("%%%02x",ord($1))/eg; print }'
%E4%F6%FC
%C3%A4%C3%B6%C3%BC

@p5pRT
Copy link
Author

p5pRT commented Dec 24, 2007

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2009

From @iabyn

On Sun, Dec 23, 2007 at 12​:49​:24PM -0800, srezic@​cpan.org wrote​:

There's a change in behaviour when passing characters with codepoints
160..255 to CGI.pm​:

$ perl5.8.8 -MCGI -e 'warn CGI->new({a=>"\xe4\xf6\xfc"})->query_string'
a=%E4%F6%FC at -e line 1.
(This is with CGI​::Util 1.5)

$ perl5.10.0 -MCGI -e 'warn CGI->new({a=>"\xe4\xf6\xfc"})->query_string'
a=%C3%A4%C3%B6%C3%BC at -e line 1.
(This is with CGI​::Util 1.5_01)

This appears to be fixed in blead and 5.10.1-tobe (i.e. I see the 588
style output from the above test code)

--
"You may not work around any technical limitations in the software"
  -- Windows Vista license

@p5pRT
Copy link
Author

p5pRT commented Sep 20, 2010

@cpansprout - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant