Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: UTF-8 from a CGI script

by ioannis (Abbot)
on Oct 22, 2005 at 04:19 UTC ( #502178=note: print w/replies, xml ) Need Help??


in reply to UTF-8 from a CGI script

A few observations regarding your utf-8 issues:

  • The reason the is_utf8() check failed is because of Perl's backward compatability issues. For hex values of "\x{00FF}" or less, the is_utf8() check is supposed to fail. Here are are a few examples using your variables:
  • binmode \*STDOUT, ':utf8'; my $u_temp = "Temperature:350\x{00B0}F html:°"; my $smiley = "Smiley:\x{263a}"; my $price_label = "Price:\x{20AC}9.99"; print 'is degree' if utf8::is_utf8( $u_temp ); print 'is smiley' if utf8::is_utf8( $smiley ); print 'is price label' if utf8::is_utf8( $price_label );
  • Others have already posted about binmode(), or 'use open' layers.
  • In addition to Perl related issues, also ensure that your fonts for X (or Linux console), as well as your browser (or xterm, or cat(1) ) are also able to display in utf8 charrs using utf-8 fonts. (I use LatCyrGr-16.psf fonts for Linux console.)

Replies are listed 'Best First'.
Re^2: UTF-8 from a CGI script
by wfsp (Abbot) on Oct 22, 2005 at 07:41 UTC

    In addition to ioannis's third point, be aware of the consequences of having UTF8 chars in your script.

    I was trapped by this until tye came to the rescue. :-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://502178]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2022-12-04 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?