Re: Opening & writing to UTF-8 files; copyright symbol again -- solution

[email protected] (Colin Campbell) Mon, 16 Nov 2015 09:41:25 +0000
Newsgroups perl.perl4lib
Message-ID <[email protected]>
On Fri, Nov 13, 2015 at 10:05:01PM +0000, Highsmith, Anne L wrote:
> I should probably say, "apparent solution" 'cause character set issues never seem to end.
> 
> However, combining Jon Gorman's recommendation with some Googling, I get:
> 
> my $outfile='4788022.edited.bib';
> open (my $output_marc, '>', $outfile) or die "Couldn't open file $!" ;
> binmode($output_marc, ':utf8');
> 
You can set the correct encoding succinctly on opening files 
 e.g. open my $fh, '>:encoding(UTF-8)', $outfile

Hope that helps
C.

-- 
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 800 756 6803 (phone)
+44 (0) 7759 633626  (mobile)
[email protected]
skype: colin_campbell2

http://www.ptfs-europe.com