Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Using encoding

by MorayJ (Acolyte)
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.


Comment on Re: Using encoding
Download Code
Re^2: Using encoding
by choroba (Abbot) 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 (Hermit) 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013142]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-08-23 16:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (174 votes), past polls