E
Elisa Francesca Roselli
I have some strings in French that have had all the diacritical marks
removed and substituted with special multi-character codes.
I need to get these strings output as natural language, with their
diacriticals restored.
What I'm trying to do is to use a hash, with the special code as the
hash key and the natural character as the value. Example:
%q_format = ('\\`e' => 'è', #plotting \`e to è
'\\\'e' => 'é', #plotting \'e to é
'\\^e' => 'ê;', #plotting \^e to ê
'\\`a' => 'à', #plotting \`a to à
'\\^o' => 'ô' ); #plotting \^o to ô
So lets say I have a French-language string in a scalar $Fr. I want to
do something like:
foreach $key(keys %q_format) {
$Fr =~s/$q_format{key}/$q_format{value}/g;
}
to substitute the key with the value. So if $Fr contains
"Vous n'avez pas l'acc\`es en \'ecriture sur "%S"
I want to see
"Vous n'avez pas l'accès en écriture sur "%S"
But that isn't working. The string outputs exactly as it went in.
What am I doing wrong?
Many thanks for your patience, to all who can assist,
Elisa Francesca Roselli
Ile de France
removed and substituted with special multi-character codes.
I need to get these strings output as natural language, with their
diacriticals restored.
What I'm trying to do is to use a hash, with the special code as the
hash key and the natural character as the value. Example:
%q_format = ('\\`e' => 'è', #plotting \`e to è
'\\\'e' => 'é', #plotting \'e to é
'\\^e' => 'ê;', #plotting \^e to ê
'\\`a' => 'à', #plotting \`a to à
'\\^o' => 'ô' ); #plotting \^o to ô
So lets say I have a French-language string in a scalar $Fr. I want to
do something like:
foreach $key(keys %q_format) {
$Fr =~s/$q_format{key}/$q_format{value}/g;
}
to substitute the key with the value. So if $Fr contains
"Vous n'avez pas l'acc\`es en \'ecriture sur "%S"
I want to see
"Vous n'avez pas l'accès en écriture sur "%S"
But that isn't working. The string outputs exactly as it went in.
What am I doing wrong?
Many thanks for your patience, to all who can assist,
Elisa Francesca Roselli
Ile de France