Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Feb 2006 14:34:44 -0500
From:      Gerard Seibert <gerard@seibercom.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: Removing BOM from UTF-8
Message-ID:  <200602181435.07066.gerard@seibercom.net>
In-Reply-To: <1140283470.17023.7.camel@ariadne.benalee.co.uk>
References:  <20060218111849.15E6.GERARD@seibercom.net> <1140283470.17023.7.camel@ariadne.benalee.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart6599138.EOb0c16ySJ
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Benjamin A'Lee wrote:

> On Sat, 2006-02-18 at 11:28 -0500, Gerard Seibert wrote:
> > It has been suggested that a script could be written to eliminate
> > the BOM from a file(s). My script writing skills suck. I have been
> > unable to locate one using Google, so I was hoping that someone
> > might know where I could either locate such a program, or perhaps
> > give me an idea on how to script one.
>
> #!/usr/bin/perl
> @file=3D<>;
> $file[0] =3D~ s/^\xEF\xBB\xBF//;
> print(@file);
>
> That'll read a file from stdin, remove the BOM from the beginning of
> the first line if it's present, and print it to stdout.
>
> Hope it helps.
>
> =C2=A0 =C2=A0 Ben
>
> --
> Termisoc Tech Officer: <http://termisoc.org/>;
> My Homepage: <http://benalee.co.uk/>;
> "People demand freedom of speech as compensation for the freedom of
> thought which they have but seldom use." -- S=C3=B8ren Kierkegaard

Maybe I am doing something wrong, but it does not appear to be working=20
correctly. I named the file nobom.sh and put it in the same directory=20
as the files I want to convert. I also set the program permission to=20
0755.

typing the p[program name does nothing; I have to precede it with=20
'perl'. Even then, it does not appear to work correctly. In the=20
following example, the file is parsed, but not converted.

perl nobom.sh testfile

Am I doing something incorrectly here?

Thanks!

=2D-=20
Gerard Seibert
gerard@seibercom.net

PGP: http://www.seibercom.net/sig/gerard.asc

--nextPart6599138.EOb0c16ySJ
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQBD93bqchM2dIO+3uMRArDTAJ45txd1ts0k2YaguTrxVGfC9eG1uwCfdgUj
DiJq15exHgDmjK6Wj4rQvnE=
=Nprd
-----END PGP SIGNATURE-----

--nextPart6599138.EOb0c16ySJ--



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