perl-unicode

Re: CGI::Util unescape() after escape() loses utf8 flag

2005-09-28 02:02:16

David Graff said:

Looking at the source for CGI::Util...

I should have mentioned that I was quoting from version 1.3 of CGI::Util,
but the relevant points are still valid in the current version (1.5).

On closer inspection of the source, I see that the "unescape" function can
accept a string like /u([0-9a-fA-F]{4})/ as well as /%([0-9a-fA-F]{2})/,
and it will correctly set the utf8 flag when decoding a string that matches
the former form; but the "escape" function can only produce the latter
form.

Perhaps it might be time to add an optional argument to "escape", that 
would allow for creating the "uHHHH" form?  It would be simple enough to 
do, I'd expect.

        Dave Graff