Hi jay,





> You haven't told us what Perl thinks the encoding of the first file
> is. 

how can I do that?

> file is a system command that makes use of number of different
> approaches to determine file type including, on some systems, I think
> it even makes use of metadata. Actually examining the data in the file
> is time-consuming, and therefore a method of last resort, employed
> only when some other context doesn't match. It also returns the first
> match, not all matches.

You're right, but my inputfile does only contain 7bit ascii data. So
every file perl creats, or modifies, should be utf8. I am working with
a ubuntu, so everything should be utf8-ified. my xterm is utf8! that
means that the "ä" in s/// is utf8, too.

<snip>

> At the command line, you can use the -C switch to avoid confusion.

If I understand you right, following code should allways create a utf8
encoded file. Since my inputfile does only contain 7bit ascii data. and
STDIN STDOUT and STDERR is changed to utf8.

% perl -C7 -wpi -e 'use encoding "utf8"; s/"o/ö/' datei
% file datei
datei: ISO-8859 text
% hexdump  -C datei
00000000  65 69 6e 65 20 74 65 73  74 20 64 61 74 65 69 0a  |eine test datei.|
00000010  64 69 65 20 22 75 20 f6  20 0a                    |die "u . .|

f6 = ö in lation1
c3 b6 = ö in utf8


Regards
Martin

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to