Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: incorrect length of strings with diphthongs

by vr (Curate)
on Aug 25, 2022 at 22:59 UTC ( [id://11146431]=note: print w/replies, xml ) Need Help??


in reply to incorrect length of strings with diphthongs

Accidentally, you'll get 65 for uppercase input, but not for the reason it seems you expect (which seems "a plain letter of any case followed by zero-width combining diaeresis". You didn't provide Perl with such input, nor you should as other answers have already pointed out, and rarely can, but see further). It just happens, that among 6 octets of utf-8 encoded input, the latter of the pair representing uppercase "Ü" ("\xC3\x9C") belongs to 0x80..0x9F range, which Unicode::GCString considers to have zero width. A few others of utf-8 encoded extended Latin would also demonstrate "false positive" "correct" result. But not lowercase "ü" -- either "alas" or "luckily" depends on viewpoint.

For correct but unnecessary "plain letter followed by combining diaeresis" and expected 2 unequal numbers output, your input could have contained "u\x{0308}", or NFD "\N{U+00fc}", or NFD 'ü' under use utf8;, or NFD "\N{LATIN SMALL LETTER U WITH DIAERESIS}", etc. For reverse cure, assuming it's required at all on top of correct decoding, I'd expect Unicode::Normalize::NFC to be of use but Unicode::GCString unnecessary for simple plain or extended Latin, but YMMV.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2024-04-19 14:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found