Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Using encoding

by MorayJ (Beadle)
on Jan 14, 2013 at 00:01 UTC ( #1013142=note: print w/replies, xml ) Need Help??

in reply to Using encoding

Hi, thanks for the answers. I'm actually thinking that I got the question wrong now though.

I think the input is text. The original input came with a sign, but this is now ascii text, possibly extended. But I can't work out what the '' sign has been translated into.

It's appearing as in notepad.

I have tried:

my $character = ord(""); $lastitem =~ s/$character/Pounds/g;

This still isn't getting it. I think I must be approaching this totally wrong. The text seems to be consistently representing the pound symbol with a character, or a number of characters, and I don't know how to isolate that.

What tools should I be looking at?

Thanks for your help - sorry for making a meal out of the question.

Replies are listed 'Best First'.
Re^2: Using encoding
by choroba (Bishop) on Jan 14, 2013 at 11:38 UTC
    ord only takes care about the first character of a string. So, $character gets assigned 194. You are then replacing "194" (as a string) by "Pounds", which does not do what you want.
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^2: Using encoding
by nikosv (Chaplain) on Jan 14, 2013 at 12:29 UTC
    in Windows the translation is from Unicode (UTF16) to ANSI according to your System "Language for non Unicode programs". So the pound sign will be broken down to bytes according to it

      Ok, I think that makes sense. So ord is not what I'm after

      What's the best way to find 'funny' characters in a text file, and to translate them into meaningful characters in a text/unicode file?

      I'm assuming that it's me that's making this difficult and it's probably quite straight forward

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2018-06-25 03:56 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.