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

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Some code from Text::FIGlet might be of some use to you:
sub UTF8ord{ my $str = shift || $_; my $len = length ($str); return ord($str) if $len == 1; #This is a FIGlet specific error value return 128 if $len > 4 || $len == 0; my @n = unpack "C*", $str; $str = (($n[-2] & 0x3f) << 6) + ($n[-1] & 0x3f); $str += (($n[-3] & 0x1f) << 12) if $len ==3; $str += (($n[-3] & 0x3f) << 12) if $len ==4; $str += (($n[-4] & 0x0f) << 18) if $len == 4; return $str; } sub UTF8chr{ my $ord = shift || $_; my @n; #x00-x7f #1 byte if( $ord < 0x80 ){ @n = $ord; } #x80-x7ff #2 bytes elsif( $ord < 0x800 ){ @n = (0xc0|$ord>>6, 0x80|$ord&0x3f ); } #x800-xffff #3 bytes elsif( $ord < 0x10000 ){ @n = (0xe0|$ord>>12, 0x80|($ord>>6)&0x3f, 0x80|$ord&0x3f ); } #x10000-x10ffff #4 bytes elsif( $ord<0x20000 ){ @n = (0xf0|$ord>>18, 0x80|($ord>>12)&0x3f, 0x80|($ord>>6)&0x3f, 0x80|$ord&0x3f); } else{ warn "Out of range for UTF-8: $ord"; } return pack "C*", @n; }
I've tested it as far back as 5.00503 IIRC.

In Bob We Trust, All Others Bring Data.

In reply to Re: Encode fails to install on Win32 5.6 by belg4mit
in thread Encode fails to install on Win32 5.6 by roadrunner

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (4)
    As of 2017-11-18 01:20 GMT
    Find Nodes?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:

      Results (276 votes). Check out past polls.