Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Replacing a character in a file

by 1nickt (Monsignor)
on Jan 03, 2018 at 20:20 UTC ( #1206629=note: print w/replies, xml ) Need Help??

in reply to Replacing a character in a file

Hi, you don't want to just throw that away! That character is produced by an encoding failure. You need to know what is the encoding of the data in your database, then decode from that to Perl when you fetch the data, then encode to the character set your output is using. That way you will get the special characters as they were originally.

(This assumes that the data was encoded correctly begin with.) Since you are on Windows your data might be encoded in Windows-1252.

Disclaimer: I am not a windows user but I saw your question had been here for a while with no replies.

To remove a character with a Perl regexp: perl -E '$str = "fxoox"; $str =~ s/x//g; say $str;' (output: foo).

See perlretut and perlrequick. But that is not the right solution here.

Hope this helps!

The way forward always starts with a minimal test.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1206629]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2018-06-24 08:18 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.