butz747 has asked for the wisdom of the Perl Monks concerning the following question:

I'd be so glad if anybody could help me. Normally when I open a file an write a string like "Datensätze" to it, the "ä" is written as a single-byte character, which is what i need. "ä" is allowed in iso-latin-1 characterset. Now, in a huge module I've written, "ä" is suddenly output as "ä", which is the unicode representation. The problem is, that I really need the output to be iso-latin-1. I have no idea what causes perl to output a two-byte character. I have tried with "no utf-8", but it didn't help. The problem may be due to me loading XML::SimpleObject or HTML::Entities. Does anybody happen to know if one of those modules sets a global switch so that output is in unicode format? Would you mind sending your reply to jpmnk /at/ grossman.de as well, as to make sure I receive asap? Thank you very much for your help, Björn

Replies are listed 'Best First'.
Re: How to output
by butz747 (Initiate) on Mar 13, 2002 at 09:28 UTC
    In fact, I found the answer myself: as soon as one variable is output that has multibyte characters in it, output switches to Unicode an all other (ISO-Latin1) characters are output as Unicode as well. To prevent this from happening, rather than writing print OUT $myunicodestring; print OUT $converter->convert("blöd"); which wouldn't have worked anyway, I now use $myisolatinstring = $converter->convert($myunicodestring); print OUT $myislatinstring etc. using Text::iconv now all works fine. Thanks, Björn