Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^5: question about Encode::decode('iso-8859-1', ...)

by ikegami (Patriarch)
on Mar 07, 2009 at 12:36 UTC ( [id://749042]=note: print w/replies, xml ) Need Help??


in reply to Re^4: question about Encode::decode('iso-8859-1', ...)
in thread question about Encode::decode('iso-8859-1', ...)

Here's a test that works with single-byte encodings:

>perl -MEncode -wle"for (0..255) { print if chr ne decode($ARGV[0], ch +r) }" iso-8859-1 >perl -MEncode -wle"for (0x20..0x7E,0x0A..0xFF) { print if chr ne deco +de($ARGV[0], chr) }" iso-8859-2 161 162 163 165 166 169 ...

Here's a UTF-8 example:

>perl -MEncode -wle"$chr=qq{\342\231\240}; print 'diff' if $chr ne dec +ode('UTF-8', $chr)" diff

Replies are listed 'Best First'.
Re^6: question about Encode::decode('iso-8859-1', ...)
by Anonymous Monk on Mar 07, 2009 at 12:58 UTC

    Yes, but that's not what the question was. It was asked whether there is any value of $x for which test($x) with the given code (i.e. decode('iso-8859-1',...)) returns 0.  By modifying the code you can of course achieve anything...  But this is kind of like

    "Is there any case in which this code will return 0?"

    sub test { if (1) { return 1; } else { retrun 0; } }

    Yes, there is:

    sub test { if (0) { return 1; } else { retrun 0; } }

      Are you saying it isn't reasonable for by borisz and I to think the OP and other readers would be interested in other encodings? It's funny how you have a problem with it, but the OP doesn't seem to.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-16 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found