perl-unicode

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

2005-09-27 20:22:23
Hi David.  Thanks for the quick responses.

David Graff wrote:
On closer inspection of the source, I see that the "unescape" 
function can accept a string like /u([0-9a-fA-F]{4})/

Yea more or less.  "%u00b0" for example.

and it will correctly set the utf8 flag

Not AFAICT:

  DB<1> x Encode::is_utf8(CGI::Util::unescape("%u00b0"))
0  ''

Perhaps it might be time to add an optional argument to "escape", 

Is %uXXXX officially sanctioned somewhere?

An optional argument is good.  But if the scalar passed to escape()
has the utf8 flag set it seems to me we could "do the right thing"
automatically.

-Stephen