Date: Sat, 18 Feb 2006 17:24:30 +0000 From: Benjamin A'Lee <lists@benalee.co.uk> To: freebsd-questions@freebsd.org Subject: Re: Removing BOM from UTF-8 Message-ID: <1140283470.17023.7.camel@ariadne.benalee.co.uk> In-Reply-To: <20060218111849.15E6.GERARD@seibercom.net> References: <20060218111849.15E6.GERARD@seibercom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
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=<>;
$file[0] =~ 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.
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øren Kierkegaard
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1140283470.17023.7.camel>
