Problem with German Umlaut

wezetel

Active Member
I have an alpha-register and using the first letter of a field. To get the first letter I'm using a calc element. But as soon as the first letter is a German Umlaut I get following error message:
upload_2023-5-18_9-4-11.png


I therefore tried following code to replace the Umlaut before it will be stored:

$buchstabe= strtoupper(substr('{dienstleistungen___dienstleistung}', 0, 1));

switch ($buchstabe){
case "Ä": $buchstabe = "A";return $buchstabe;
case "Ö": $buchstabe = "O";return $buchstabe;
case "Ü": $buchstabe = "U";return $buchstabe;
default:return $buchstabe;
}

But the error remained. Any idea, what I'm doing wrong?
 
I don't get an error while returning and storing Ä in a calc.
What is your database collation, table collation and collation of the calc column?
It should all be UTF8 or so.

Your code: I assume it's still not Ä etc so always returning the original.

If you really need to convert (because of??) you can try $buchstabe=(string)$buchstabe; or some conversion like https://www.php.net/manual/de/uconverter.transcode.php
 
Collation for database, table and column is all utf8_general_ci and if I don't try to get the first letter and doing any conversion, the whole value of the referenced field ist stored...
Basically I just can't extract the first letter if it is a German Umlaut :-(
 
You're my hero...
Now I've learned: string is not always string...
mb_substr solved my problem
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top