Gary Kline wrote:
Whenever I save a wordpeocessoe file [OOo, say] into a text file, I get a slew of hex codes to indicate the char to be used. I'm looking for a perl one-liner or script to translate hex back into ', ", -- [that's a dash), and so forth. Why does this fail to trans the hex code to an apostrophe?perl -pi.bak -e 's/\xe2\x80\x99/'/g'If there any another other tools, I'm interested!
That's a problem with shell quoting rather than perl. You're using ' as the delimiter on your command line, so you need to escape any instances within commands. Or you can replace a literal ' with the ASCII character code \x27. However, in the more general sense what you are doing is replacing certain UTF-8 character codes with similar characters from the ASCII range. That sounds to me like a job for iconv(1) -- in ports as converters/libiconv Cheers, Matthew -- Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate Kent, CT11 9PW
Description: OpenPGP digital signature