Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Getting mad with CGI::Application and utf8

by Juerd (Abbot)
on Feb 26, 2008 at 20:43 UTC ( #670389=note: print w/ replies, xml ) Need Help??


in reply to Getting mad with CGI::Application and utf8

[moritz] already pointed out that you shouldn't do _utf8_on. The :utf8 IO layer does the same thing and should also not be used. Using _utf8_on or :utf8 may result in serious malfunction and security holes.


Comment on Re: Getting mad with CGI::Application and utf8
Re^2: Getting mad with CGI::Application and utf8
by Anonymous Monk on May 15, 2008 at 18:37 UTC
    There is another aproach: one i use from time to time. Dont use perls borken utf-8 support. Pass the Argument -C0 to perl at the head of your script , and perl will treat all strings as raw binary. As long as you only break your strings on well defined boundaries, and dont attempt to naively count characters, it will work fine. If you need to truncate a string at a certain arbitrary point, such as "100 bytes" or so, you will have to make sure it stops at a well defined UTF-8 endpoint.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-12-28 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (180 votes), past polls