From owner-freebsd-questions@FreeBSD.ORG Fri Oct 9 09:28:32 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E57BB1065692 for ; Fri, 9 Oct 2009 09:28:31 +0000 (UTC) (envelope-from m.seaman@infracaninophile.co.uk) Received: from smtp.infracaninophile.co.uk (gate6.infracaninophile.co.uk [IPv6:2001:8b0:151:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 6DFF88FC1C for ; Fri, 9 Oct 2009 09:28:31 +0000 (UTC) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [IPv6:::1]) (authenticated bits=0) by smtp.infracaninophile.co.uk (8.14.3/8.14.3) with ESMTP id n999SPIk088960; Fri, 9 Oct 2009 10:28:26 +0100 (BST) (envelope-from m.seaman@infracaninophile.co.uk) X-DKIM: Sendmail DKIM Filter v2.8.3 smtp.infracaninophile.co.uk n999SPIk088960 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infracaninophile.co.uk; s=200708; t=1255080506; bh=6d1qyNvvoeu0YHx/gP4Wg3MvR7qcUPTJPifvQ2t6qRA=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type:Cc:Content-Type:Date:From:In-Reply-To: Message-ID:Mime-Version:References:To; z=Message-ID:=20<4ACF0231.5010801@infracaninophile.co.uk>|Date:=20F ri,=2009=20Oct=202009=2010:28:17=20+0100|From:=20Matthew=20Seaman= 20|Organization:=20Infracaninophi le|User-Agent:=20Thunderbird=202.0.0.23=20(X11/20090823)|MIME-Vers ion:=201.0|To:=20Gary=20Kline=20|CC:=20FreeBSD= 20Mailing=20List=20|Subject:=20Re:= 20for=20perl=20wizards.|References:=20<20091009083516.GA60096@thou ght.org>|In-Reply-To:=20<20091009083516.GA60096@thought.org>|X-Eni gmail-Version:=200.95.6|Content-Type:=20multipart/signed=3B=20mica lg=3Dpgp-sha256=3B=0D=0A=20protocol=3D"application/pgp-signature"= 3B=0D=0A=20boundary=3D"------------enigBC34C3692B9A49FDCA88C9F8"; b=ZI5QZUxgBNDJ4kXe8H5SBmO3TLJkGmjbjEYPqWH6Q82fJLPJLbKrkBoNsI1fd0Gpi pWkWR3HuSvIKYHQQcb1FhRL18amfxliSRkoXZXsntGY7Ll7yDhs3aDQG+XFhJew1Or 40JD8bkMMKgs+8pq97HQxCXY/4dZ/kr9MSXZHyOs= X-Authentication-Warning: happy-idiot-talk.infracaninophile.co.uk: Host localhost [IPv6:::1] claimed to be happy-idiot-talk.infracaninophile.co.uk Message-ID: <4ACF0231.5010801@infracaninophile.co.uk> Date: Fri, 09 Oct 2009 10:28:17 +0100 From: Matthew Seaman Organization: Infracaninophile User-Agent: Thunderbird 2.0.0.23 (X11/20090823) MIME-Version: 1.0 To: Gary Kline References: <20091009083516.GA60096@thought.org> In-Reply-To: <20091009083516.GA60096@thought.org> X-Enigmail-Version: 0.95.6 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigBC34C3692B9A49FDCA88C9F8" X-Virus-Scanned: clamav-milter 0.95.2 at happy-idiot-talk.infracaninophile.co.uk X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VERIFIED,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on happy-idiot-talk.infracaninophile.co.uk Cc: FreeBSD Mailing List Subject: Re: for perl wizards. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 09:28:32 -0000 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--