$text =~ s/Æ//gi; $text =~ s/ì//gi;

This hints to me that you might be having encoding issues rather than people actually entering these characters. Since you haven't shown any of your code of how you actually get $text, I can't make any suggestions as to how you can fix it, but you should be fixing this at the source.

$text =~ s/&//gi; ... $text =~ s/\x95/\<li\>/gi;

Are you processing the raw RSS (XML) directly? I already said it two weeks ago: Do not use regular expressions to process XML/HTML. In this case the correct solution would be to either use an XML module and only apply the regexes to the content of text nodes, or to process the text before putting it in the XML.

$text =~ s/’/'/gi;

I might suggest Text::Unidecode for these kind of replacements.

$text =~ s/\x9s/-/gi;

Use strict and warnings.

These are the bullets when copied out of the text, but using this code doesn't work:

Did you save your Perl file as UTF-8 and declare use utf8;? SSCCE.


In reply to Re: Stripping bad characters in rss by haukex
in thread Stripping bad characters in rss by htmanning

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.