Possibly a typo in either your code or when posting; regardless, \x{BC} is 1/4 as a single character, not mu.

Both substitution and transliteration work, as shown in the code below. [I used the /r option for demonstration purposes. You may not need or want this; but, if you do, you'll need Perl v5.14 or later to use it (see "perl5140delta: Non-destructive substitution").]

$ perl -E ' use strict; use warnings; use utf8; use open OUT => qw{:encoding(UTF-8) :std}; use Unicode::UCD "charinfo"; say "\x{B5} = ", charinfo(0xB5)->{name}; say "\x{BC} = ", charinfo(0xBC)->{name}; say "\x{3BC} = ", charinfo(0x3BC)->{name}; my $contents = "\x{B5} \x{BC} \x{3BC}"; print "Original \$contents: "; say $contents; print "Non-desctructive s///: "; say $contents =~ s/[\x{B5}\x{3BC}]/u/gr; print "Unchanged \$contents: "; say $contents; print "Non-desctructive y///: "; say $contents =~ y/\x{B5}\x{3BC}/u/r; print "Unchanged \$contents: "; say $contents; '

Output:

µ = MICRO SIGN
¼ = VULGAR FRACTION ONE QUARTER
μ = GREEK SMALL LETTER MU
Original $contents:    µ ¼ μ
Non-desctructive s///: u ¼ u
Unchanged $contents:   µ ¼ μ
Non-desctructive y///: u ¼ u
Unchanged $contents:   µ ¼ μ

See also the Unicode PDF code charts: "C1 Controls and Latin-1 Supplement" (for x{B5} & \x{BC}); and, "Greek and Coptic" (for \x{3BC}).

— Ken


In reply to Re: Substituting unicode character leaves special block by kcott
in thread Substituting unicode character leaves special block 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.