Hi all. I am processing some twitter user names that have unwanted multibyte UTF-8 characters in them. I got the ORD values of these using the following script:
use feature ':5.10'; my $foo = '⁦JenAFifield⁩'; foreach my $i (0..length($foo)) { $char = substr($foo,$i,1); $charnum = ord($char); say "$char\t$charnum"; }
but I see this forum is replacing the characters with some other encoding I don't recognize. In my editor (Komodo) They are at the beginning and end of the $foo string. The beginning one is a dotted box with LRI inside, and the end one has the same box with PDI inside. The script returns:
226 129 166 J 74 e 101 n 110 A 65 F 70 i 105 f 102 i 105 e 101 l 108 d 100 226 129 169
where in my editor the undisplayable char is a black rectangle with HOP inside. I'm not sure why it displays like that because ASCII 129 should be u-umlaut.

Am wondering how to do a regexp that will get rid of these chars. Based on numbers shown here I tried $foo =~ s/\x8294|\x8297//g; but that didn't do it. Can anyone help?

I am Satoshi Nakamoto


In reply to Removing multibyte UTF-8 chars from strings by cormanaz

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.