perldoc -f fc says using lc to compare strings is "Wrong!" and that uc is "Also wrong!" and that we should use "fc" or a regex. Comparing lc, uc and fc shows that only lc actually works, while uc fails, and fc doesn't even exist. What's going on?

perl -le 'print $]'
5.028000

perl -CS -le 'print    "\x{1e9e}"'
ẞ

perl -CS -le 'print lc "\x{1e9e}"'
ß

perl -CS -le 'print    "\x{00df}"'
ß

perl -CS -le 'print uc "\x{00df}"'
ß

perl -CS -le 'print lc "\x{1e9e}" eq    "\x{00df}" ? 1 : 0;'
1

perl -CS -le 'print    "\x{1e9e}" eq uc "\x{00df}" ? 1 : 0;'
0

perl -CS -le 'print lc "\x{1e9e}" eq lc "\x{00df}" ? 1 : 0;'
1

perl -CS -le 'print uc "\x{1e9e}" eq uc "\x{00df}" ? 1 : 0;'
0


perl -CS -le 'print fc "\x{1e9e}" eq fc "\x{00df}" ? 1 : 0;' String found where operator expected at -e line 1, near "fc "\x{00df}"" (Do you need to predeclare fc?) syntax error at -e line 1, near "fc "\x{00df}"" Execution of -e aborted due to compilation errors.
perl -CS -le 'print fc("\x{1e9e}") eq fc("\x{00df}") ? 1 : 0;' Undefined subroutine &main::fc called at -e line 1.
perldoc -f fc fc EXPR fc Returns the casefolded version of EXPR. This is the internal function implementing the "\F" escape in double-quoted strings. Casefolding is the process of mapping strings to a form where case differences are erased; comparing two strings in their casefolded form is effectively a way of asking if two strings are equal, regardless of case. Roughly, if you ever found yourself writing this lc($this) eq lc($that) # Wrong! # or uc($this) eq uc($that) # Also wrong! # or $this =~ /^\Q$that\E\z/i # Right! Now you can write fc($this) eq fc($that) And get the correct results.

In reply to unicode lc uc fc wtf by Anonymous Monk

Title:
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, details, 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, summary, 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.