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

Re: The “real length" of UTF8 strings

by massa (Hermit)
on Sep 24, 2008 at 00:16 UTC ( [id://713326]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    perl -C63 -MDevel::Peek -Mutf8 -le '$_="(\x{5fcd} Guimarăes)"; Dump($_
    +); print length($_); print'
    SV = PV(0x8154b00) at 0x8153bd4
    ...
      CUR = 16
      LEN = 20
    13
    
  2. or download this
    perl -C63 -MDevel::Peek -Mutf8 -MUnicode::Normalize -le '$_="(\x{5fcd}
    + Guimarăes)"; $_ = NFD $_; Dump($_); print length($_); print'
    SV = PV(0x8154b00) at 0x8153bd4
    ...
      CUR = 17
      LEN = 20
    14
    
  3. or download this
    perl -C63 -MDevel::Peek -Mutf8 -mText::CharWidth=mbswidth -le '$_="(\x
    +{5fcd} Guimarăes)"; Dump($_); print mbswidth($_); print'
    SV = PV(0x8154b00) at 0x8153bd4
    ...
      CUR = 16
      LEN = 20
    14
    
  4. or download this
    perl -C63 -MDevel::Peek -Mutf8 -mEncode=encode_utf8 -le '$_="(\x{5fcd}
    + Guimarăes)"; Dump($_); print length(encode_utf8 $_)'
    SV = PV(0x8154b00) at 0x8153bd4
    ...
      CUR = 16
      LEN = 20
    16
    

Log In?
Username:
Password:

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

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

    No recent polls found