I have a string entered into a HTML form statement in a webpage. PROGRAM1.html passes the string to a PHP script PROGRAM3.PHP via an intermediary PHP script PROGRAM2.PHP.
Pseudo: PROGRAM1.html string--> PROGRAM2.PHP string--> PROGRAM3.PHP
I use the following method to perform what unicode.org calls diacritical folding -getting rid of all the accent marks and replacing accented letters with no-accent letters:
But this just doesn't work no matter how simple I make the code. I also tried just about all the other diacritical folding solutions shown on the PHP strtr man page. None work for me. So I start three new files from scratch: PROGRAM1B.html, PROGRAM2B.PHP and PROGRAM3B.PHP. Note the 'B'. I used notepad++. Bit by bit I copy a little code from each of the original three to the new three, establishing a little functionality in the new three scripts as I go. When all code has been copied from the original three to the new three, the above code works perfectly in the new three scripts but the original three still don't work and its all the same code running on the same server and the only difference is the new three scripts have a 'B' in their name!!!!! Arrrgh!
So I say: I'll just get rid of the original three and rename the new three to take the 'B' out. After renaming, the new three now produce a bizzare translation of the diacritic letters to some weird character set not represented in the function above.
I guess the answer here is perhaps a whole topic I am unfamiliar with.
By the way, as you may know unicode will not be supported until version 6 of PHP.
Pseudo: PROGRAM1.html string--> PROGRAM2.PHP string--> PROGRAM3.PHP
I use the following method to perform what unicode.org calls diacritical folding -getting rid of all the accent marks and replacing accented letters with no-accent letters:
Code:
function FoldDiacritics($changestr)
{
echo '<BR> BEFORE AAA $changestr=' . $changestr . '<BR>';
$changestr = strtr($changestr, "àáâåãä", "aaaaaa");
$changestr = strtr($changestr, "èéêë", "eeee");
$changestr = strtr($changestr, "ß", "b");
$changestr = strtr($changestr, "ìíîï", "iiii");
$changestr = strtr($changestr, "òóôõö", "ooooo");
$changestr = strtr($changestr, "š", "s");
$changestr = strtr($changestr, "ç", "c");
$changestr = strtr($changestr, "ùúûü", "uuuu");
$changestr = strtr($changestr, "š", "s");
$changestr = strtr($changestr, "ƒ", "f");
$changestr = strtr($changestr, "ñ", "n");
echo '<BR> AFTER BBB $changestr=' . $changestr . '<BR>';
return $changestr;
}
?>
But this just doesn't work no matter how simple I make the code. I also tried just about all the other diacritical folding solutions shown on the PHP strtr man page. None work for me. So I start three new files from scratch: PROGRAM1B.html, PROGRAM2B.PHP and PROGRAM3B.PHP. Note the 'B'. I used notepad++. Bit by bit I copy a little code from each of the original three to the new three, establishing a little functionality in the new three scripts as I go. When all code has been copied from the original three to the new three, the above code works perfectly in the new three scripts but the original three still don't work and its all the same code running on the same server and the only difference is the new three scripts have a 'B' in their name!!!!! Arrrgh!
So I say: I'll just get rid of the original three and rename the new three to take the 'B' out. After renaming, the new three now produce a bizzare translation of the diacritic letters to some weird character set not represented in the function above.
I guess the answer here is perhaps a whole topic I am unfamiliar with.
By the way, as you may know unicode will not be supported until version 6 of PHP.