Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Faster utf8 escaping.

by ikegami (Patriarch)
on Apr 07, 2009 at 22:20 UTC ( [id://756165]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -MEncode=encode,from_to -wle'$s = encode("UTF-8", chr(0x2660));
    + from_to($s, "UTF-8", "ascii", Encode::FB_XMLCREF); print $s' | od -c
    0000000 342 231 240  \n
    0000004
    
  2. or download this
    $ perl -MEncode=encode,from_to -wle'$s = encode("UTF-8", chr(0x2660));
    + from_to($s, "UTF-8", "ascii", Encode::FB_XMLCREF); print $s' | od -c
    0000000   &   #   x   2   6   6   0   ;  \n
    0000011
    
  3. or download this
    1..1
    not ok 1 - With XML/HTML 4 digit hex entity
    ...
    #          got: '\u2660\u2660'
    #     expected: '♠\u2660'
    # Looks like you failed 1 test of 1.
    
  4. or download this
    #!/usr/bin/perl -T
    
    ...
    }
    
    is( escape_with_encode($_->[0]), $_->[1], $_->[2] ) for @tests;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-03-29 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found