Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
lc() is rocket fast because this only involves fiddling with one bit within a byte.

That's only true for ASCII. For Unicode, things are quite different and will probably need some kind of table lookup. Just an example for the german language:

Upper Case CharacterCharacter CodeLower Case CharacterCharacter Code
U+00C4U+00E4
U+00D6U+00F6
U+00DCU+00FC
U+1E9EU+00DF

And unfortunately, that's not all. The LATIN CAPITAL LETTER SHARP S, as ẞ is called in Unicode, is very new. First proposals are about 140 years old, but it became part of the standard german orthography in 2017, after becoming part of Unicode in v5.1.0 (April 2008) and of ISO/IEC 10646 (June 2008).

Before that (i.e. up to 2017), converting LATIN SMALL LETTER SHARP S to upper case resulted in converting it to SS or SZ. And to make things worse, the conversion depends on context. SZ is always ok, but considered harder to read. In general, SS was (and still is) used, except where it may cause misunderstandings. A common example for that problem is "Mae" (dimensions) vs. "Masse" (mass), both can be upper-cased to "MASSE". The meaning can often be derived from the context, to avoid misunderstandings, "Mae" would be upper-cased to "MASZE". Reversing that (i.e. implementing lc()) opens another can of worms, as other words may contain "ss" or "sz" that must not be converted to "". The LATIN CAPITAL LETTER SHARP S solves that problem nicely, lc("ẞ") is always "", no funny context rules needed.

See also https://en.wikipedia.org/wiki/%C3%9F#Development_of_a_capital_form.

BTW, swiss standard german solved that problem differntly: was completely replaced by "ss" in the 20th century (mainly between the 1940s and 1970s). "Mae" vs. "Masse", both written as "Masse", has to be resolved by context.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^9: Problem with regex wildcard operator (.)...? by afoken
in thread Problem with regex wildcard operator (.)...? by sbrothy

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-11-29 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?