Hi,
I've just dug up some code I used in a perl script I had written. Got the idea from an OReilly book.
The idea is to modify data that will be displayed in order for it to be HTML compliant and hence compatible with most browsers. Some seem to be able to display for example the word summer in French correctly when I type "été" others (older ones) seem to need it to be written été
This is the code I used in my perl script :
$description = &conversion_html ($description);
and this is the sub routine :
########################## Accents html conversion
conversion_html {local ($chaine) = @_;local (%signes_html, $chaine_html);
%caracteres_html =
(
'à', 'à',
'â', 'â',
'é', 'é',
'è', 'è',
'ê', 'ê',
'î', 'î',
'ô', 'ô',
'ù', 'ù',
'û', 'û',
'ç', 'ç',);
$chaine_html =
join ("", keys %caracteres_html);$chaine =~ s/([$chaine_html])/$caracteres_html{$1}/go;return ($chaine);
##########################
As you can see this would also work to provide the correct codes if modified for most european languages.
I was trying to create a sub for it so that I could let my editors simply type in with accents their reviews and then this would convert to html compliant code.
But this was written years ago and I'm not really sure what to do about creating a sub. I've tried and failed miserably with 500 errors each time. If anybody has any ideas I'm sure this could be useful to others aswell...
Thanks, John
Significant Media
I've just dug up some code I used in a perl script I had written. Got the idea from an OReilly book.
The idea is to modify data that will be displayed in order for it to be HTML compliant and hence compatible with most browsers. Some seem to be able to display for example the word summer in French correctly when I type "été" others (older ones) seem to need it to be written été
This is the code I used in my perl script :
$description = &conversion_html ($description);
and this is the sub routine :
########################## Accents html conversion
conversion_html {local ($chaine) = @_;local (%signes_html, $chaine_html);
%caracteres_html =
(
'à', 'à',
'â', 'â',
'é', 'é',
'è', 'è',
'ê', 'ê',
'î', 'î',
'ô', 'ô',
'ù', 'ù',
'û', 'û',
'ç', 'ç',);
$chaine_html =
join ("", keys %caracteres_html);$chaine =~ s/([$chaine_html])/$caracteres_html{$1}/go;return ($chaine);
##########################
As you can see this would also work to provide the correct codes if modified for most european languages.
I was trying to create a sub for it so that I could let my editors simply type in with accents their reviews and then this would convert to html compliant code.
But this was written years ago and I'm not really sure what to do about creating a sub. I've tried and failed miserably with 500 errors each time. If anybody has any ideas I'm sure this could be useful to others aswell...
Thanks, John
Significant Media