Re: French Accents appear incorrectly...



On 01/29/2007 11:36 AM, nigel@xxxxxxxxxxxxx wrote:
Hi,

I'm creating a French web site. I've used Dreamweaver to develop most of the site and have simply typed the french with accents. This all displays fine. I've used DreamWeaver to create a library object for the menu of the site (to avoid having multiple copies of exactly the same html). I've now uploaded the library object to my server in order that a perl program can read the contents of that file and output a page of html complete with the menu for the site, but here I've run into a problem: the accented letters are being displayed incorrectly. For example an 'é' (e with an acute accent) is being displayed as a capital A with two dots over it folowed by the copyright symbol.

It sounds like the library file was encoded in UTF8, and your perl program is reading it in iso-8859-1 (or something like that).

This only happens for the text that is being read from the library object file, an e with an acute accent typed into the perl program and printed directly displays correctly. So I think the problem must be related to how I read and then write the library object file. Here is my code:

#######################################################################
######################

# Open and read the contents of the headerMenu template...
open(INPUT, "../Library/headerMenuFr.lbi") ||

Try this:

open(INPUT, '<:utf8', "../Library/headerMenuFr.lbi") ||

&printErrorMessage("Error 001 : Can't open the 'headerMenuFr' file in: $program");

while(<INPUT>) {
push(@records1,$_);
}

close(INPUT)|| &printErrorMessage("Error 012 : Can't close the 'headerMenuFr' file in: $program");

# Now read through the header and print it...

$recnum = @records1;
for ($i=0; $i<$recnum; $i++) {

print $records1[$i];
}

#######################################################################
#####################

If anyone has any bright ideas as to what I'm doing wrong and how to correct it, I'd like to hear them!

Thanks in advance,

Nigel


Also read "perldoc -f binmode"

HTH

--
Windows Vista and your freedom in conflict:
http://techdirt.com/articles/20061019/102225.shtml
.