When I use a wiki extension to pass "Grätz" to this function:
function convertSpecialCharsForSearchStr( $input ) { $output = $input; $output = ereg_replace("ä","%", $output); } The special character doesn't match anything in a reg ex, or a comparison operation (eg "if $input == "Grätz" fails the comparison, even though $input contains the string "Grätz").
I get this:
'Grätz' , instead of this:'Gr%tz'
However, if I assign the $input variable the same value as a literal (as a debug test), or do the "artificial manipulation" described below, it works, replacing the " ä " successfully.
I've had to do this artificial manipulation to get it to work:
if (ereg("Gr.+tz", $input)) { $theKreis = 'Grätz'; } else { $theKreis = $input; }
I have the same problem when using the value passed from the wiki extension in an SQL query. I have to use the above manipulation, or else the "WHERE" phrase that uses the value won't work properly.
If I display the un-manipulated value (as a debug), it displays correctly.
Why can't I use the value as passed from the wiki expression? Is there a simpler way to fix this, some sort of conversion function? For the data that I'm working with for the next several months, there is only one Kreis that uses special characters, but that could change later.
James Birkholz admin, Posen-L mailing list and website http://www.Posen-L.com