Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 09 Oct 2009 10:28:17 +0100
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Gary Kline <kline@thought.org>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: for perl wizards.
Message-ID:  <4ACF0231.5010801@infracaninophile.co.uk>
In-Reply-To: <20091009083516.GA60096@thought.org>
References:  <20091009083516.GA60096@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigBC34C3692B9A49FDCA88C9F8
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

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?
>=20
> 	perl -pi.bak -e 's/\xe2\x80\x99/'/g' =20
>=20
> 	If there any another other tools, I'm interested!
>=20

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 instance=
s
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 certai=
n
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

--=20
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW


--------------enigBC34C3692B9A49FDCA88C9F8
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.13 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREIAAYFAkrPAjkACgkQ8Mjk52CukIxI7QCfTpW/aAAmzC4wVahWPD3A4c/H
TjIAnRvRkZdANkVOefY6uMn0jj5B2/sC
=rb6t
-----END PGP SIGNATURE-----

--------------enigBC34C3692B9A49FDCA88C9F8--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ACF0231.5010801>