S
Stephen Adam
Hi there,
I'm having problems when reading in the "£" character from a file, they all
get converted into u's with an accent (?). Can anyone tell me why this is
happening and how to avoid it, its got me very confused.
Just run this program and make sure you place a file the same directory
called test.txt with some pound signs (£) in it, they keep getting
mytseriously turned into accented u's.
Thanks
Steve
PS - I'm running Perl on a Windows XP platform if thats any help.
#!C:/Perl/bin/perl.exe -w
# This program will read a file in the same directory called test.txt into
the "$whole" variable and
# then print it out
use strict;
&Datain();
exit(0);
sub Datain(){
our $FILEHANDLE = "./test.txt";
my $whole;
open("FILEHANDLE") or
die ("Unable to open file $FILEHANDLE\n Program Quiting\n");
while(my $line = <FILEHANDLE>){
chomp $line; # Get rid of new line char
$line .=" "; # Put blank space instead
$line =~ tr/[A-Z]/[a-z]/; # Put line variable into lowercase
$whole .= $line;
}
print "$whole";
}
I'm having problems when reading in the "£" character from a file, they all
get converted into u's with an accent (?). Can anyone tell me why this is
happening and how to avoid it, its got me very confused.
Just run this program and make sure you place a file the same directory
called test.txt with some pound signs (£) in it, they keep getting
mytseriously turned into accented u's.
Thanks
Steve
PS - I'm running Perl on a Windows XP platform if thats any help.
#!C:/Perl/bin/perl.exe -w
# This program will read a file in the same directory called test.txt into
the "$whole" variable and
# then print it out
use strict;
&Datain();
exit(0);
sub Datain(){
our $FILEHANDLE = "./test.txt";
my $whole;
open("FILEHANDLE") or
die ("Unable to open file $FILEHANDLE\n Program Quiting\n");
while(my $line = <FILEHANDLE>){
chomp $line; # Get rid of new line char
$line .=" "; # Put blank space instead
$line =~ tr/[A-Z]/[a-z]/; # Put line variable into lowercase
$whole .= $line;
}
print "$whole";
}