Pearl messed up text encoding at edit site

Input content is an html fragment copied from a webkit window, for example

enter image description here

It displays correctly in a web set using UTF-8.

What I want to do is replace all the tags, I use this single line font:

perl -i -pe "s/<img.+?>//g"

Input is rich text that I copied to my clipboard and redirected to this one-line by another program, maybe this is something like:

echo "rich html text" | perl -i -pe "s/<img.+?>//g"

Well, it removes tags <img>, but all Unicode characters get corrupted after wildcard.

enter image description here

I am on Windows 7, locale En - US. The cmd code page is already installed in UTF-8. It does not work even if I pass the parameter -C.

Is there a way to save the code as single-line while it works for Unicode input?

+3
source share
2

perl :

use open ":encoding(utf8)";

-M:

perl -Mopen=:encoding(utf8) -i -pe "s/<img.+?>//g"

( @TLP ).

.

0

perl -COE -i -pe "s/<img.+?>//g" input , -COE unicode STDIN, STDOUT.

. perldoc perlrun.

0

All Articles