Title: Message

Success - I found this

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=20020429145407.00874.00005678%40mb-me.aol.com&rnum=1&prev=/groups%3Fq%3Dperl%2Bpack%2Bcgi%2Butf%2BOR%2Butf8%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26as_qdr%3Dall%26selm%3D20020429145407.00874.00005678%2540mb-me.aol.com%26rnum%3D1

This line can take a UTF8 input and tag it as UTF8

$text = pack('U*', unpack('U*', $q->param('text')));

Which actually is what Peter Guzis said - sorry for not understanding this the first time peter.

Is this the only way to tag a string that has come in from CGI as UTF8? I will also pose this question on perl-unicode.

Not sure how this fits in with template toolkit - other than insisting that if people are working with utf8 they need to do this with their variables. I don't think you want to do this as default as I expect there is a small penalty.

Thanks

Mark

-----Original Message-----

From: Mark Proctor [mailto:[EMAIL PROTECTED]]

Sent: 20 November 2002 18:47

To: 'Barry Caplan'; 'Andreas J. Koenig'

Cc: [EMAIL PROTECTED]

Subject: RE: CGI and UTF

 

Unfortunetly I have asked the cisco admins if we can have perl5.8 and

they said no way.

I have tried doing stuff like this:

$text = $q->param('text');

if ($q->param('text')) {

print $text . $xml->{message};

} else {

print "\x{00F3}" . $xml->{message};

}

And it works and displays fine. I display this in the textarea, so that

I can resubmit it, it comes back mangled still :(

Mark

-----Original Message-----

From: Barry Caplan [mailto:[EMAIL PROTECTED]]

Sent: 20 November 2002 18:42

To: Mark Proctor; 'Andreas J. Koenig'

Cc: [EMAIL PROTECTED]

Subject: RE: CGI and UTF

 

Mark,

I think 5.8 has a encode module with a normalize function. CPAN probably

has something similar. The perl docs for those modules is probably a

good place to start to understand unicode normalization. unicode.org is

the definitive source but could be pretty pedantic if this is your first

exposure.

Barry Caplan

www.i18n.com

At 05:38 PM 11/20/2002 +0000, Mark Proctor wrote:

>I have checked with the sysadmins at cisco and they said "no way" :(

>So I have to get this working. Someone has said that I need to

>"normalise" the params from cgi - but I have no idea what that means.

>

>Mark

 

 

Reply via email to