-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Sobey Sent: Tuesday, March 28, 2006 9:38 AM To: PerlWin32Users Subject: RE: How to read/write text files with "unicode" encoding?
>Assuming you are talking about 'Windows Unicode', the encoding you are after is UTF-16LE. I replaced your open IN with: >open IN, "<:raw:encoding(UTF-16LE):crlf", "$glossaryout" >and your open OUT with: >open OUT, ">:raw:encoding(UTF-16LE):crlf", "$newout" >for output, Windows then likes you to add a byte order mark (BOM) before any other data, as follows: >print OUT "\x{feff}"; >It throws a warning when printing that character - no idea how to suppress it - but the resulting file looks good, and a >quick look at a hex view suggests your data is being preserved. >I'll be honest and admit I don't completely understand all this, but I fiddled for ages a while back when having to create >files which were 'unicode', and this set of options seemed to do the job. Excellent!! Thanks so much, definitely seems to do what I need. :) >I gave up on your example two! I'm going to give up on it as well - since I need control over the filehandle. Too bad, the File::Sort module worked well for me in the past... Well, always a learning process. :) >Modified script attached - hope it helps. Yes, Thanks again!! >Cheers, >Paul Best Regards, -Bill _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs