perl-unicode

Re: Mixing Unicode and Byte output on a Unicode enabled Perl 5.8.0

2003-10-09 03:30:04
On Thu, 9 Oct 2003, Frank Smith wrote:

I am trying to use the £ (pound sterling) symbol in a script that
produces both TEXT and HTML the html handles the Unicode fine, all the
browsers seem to work. However, once the text file arrives on the Windowz
box the Unicode £ screws Excel.

Can you help by suggesting a way to force a specific script to produce
'plain text' (That bit more than ASCII) or preferably to specifically
output, via the IO layer, 'plain text' on specific occasions.

  Well, there's nothing that prevents you from using UTF-8 for *plain
text*.  I've got tens of thousands of UTF-8 plain text files and am
making one now (because I'm gonna send this email in 'text/plain;
charset=UTF-8')

  Anyway, what you want is to get your output in Windows-1252
(or its subset ISO-8859-1) so that Excel running under English version
of Windows 9x/ME or Windows 2k/XP with the default locale set to English
can read your text output with £.  The man page of 'Encode' should help
you (see the section Encoding via PerlIO).

  Alternatively, if you're on Win2k/XP (and don't care about Win9x/ME),
you can prepend your UTF-8 plain text output with UTF-8 BOM (that is, at
the very beginning of your plain text output file, print out "\x{feff}").
With UTF-8 BOM present, Win2k/XP should be able to detect that your
plain text file is in UTF-8 instead of legacy 'code pages'.

  Jungshik

<Prev in Thread] Current Thread [Next in Thread>