robinbowes has asked for the wisdom of the Perl Monks concerning the following question:
I'm replacing "bad" characters in HTML files.
An example of the sort of characters that I'm replacing is:
Ÿ (Not sure how that will come out - it appears as a square box in my source file but appears to get converted to on here)
I've got it in my code as:
However, I'd really like to be able to produce the from "string" programatically, i.e. represent it using pure ascii character.from => qq{Ÿ}, to => q{Ÿ},
I've hex-dumped the source file and the thing between the {} appears as:
i.e. the character is represented by the c2 9f hex digits.000018c0 20 20 46 72 6f 6d 20 20 3d 3e 20 71 71 7b c2 9f | From = +> qq{..|
If I do a test script, and do something like:
And pipe the output to hexdump, I see that $teststring has 4 characters:binmode(STDOUT, ":utf8"); my $teststring = qq{Ÿ}; print "$teststring\n";
So, how do I produce a data structure that holds exactly the same content as "from => qq{}" without having the binary character in my source code?c3 82 c2 9f
Thanks for any help. R.
--
Robin Bowes | http://robinbowes.com
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Representing "binary" character in code?
by graff (Chancellor) on Nov 05, 2006 at 05:57 UTC | |
by robinbowes (Beadle) on Nov 05, 2006 at 13:14 UTC | |
by robinbowes (Beadle) on Nov 05, 2006 at 13:51 UTC | |
by graff (Chancellor) on Nov 06, 2006 at 02:27 UTC | |
|
Re: Representing "binary" character in code?
by ysth (Canon) on Nov 05, 2006 at 05:35 UTC | |
|
Re: Representing "binary" character in code?
by GrandFather (Saint) on Nov 05, 2006 at 04:40 UTC | |
|
Re: Representing "binary" character in code?
by Errto (Vicar) on Nov 05, 2006 at 05:07 UTC |