Hi all. Got a bit of a problem with this.
Here's my code:
<?php header('Content-Type: text/html; charset=utf-8'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
echo strtolower("TWIUBCÜ");
echo "TWIUBCÜ";
?>
</body>
</html>
OK, perhaps the header and the meta tag are a bit of an overkill, but never mind.
The second echo displays the Ü, no problem. The first however, gives me a �! Yes, that horrible diamond encrusted question mark.
Now having researched, I know strtolower can't cope with UTF-8 very well, so it suggests using the mb_ functions. Fine. BUT, using strtoupper() actually works by showing accented characters as the original case. Why the difference between them?
This isn't life or death, but the acursed diamond is messing up my ajax script - the strtolower() returns a NULL (via js) if it contains an accented character.
Pretty screwy?
//EDIT
Oh no!
Even using mb_strtolower() does the same! I'm using Apache 2.2.14 / php 5.3.1 on Vista.
phpinfo() says:
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.3
Content-Type text/html; charset=utf-8
I get the same problem on my Linux remote server too.
Oh boy, even worse now, I've found that strtoupper("TWIUBCÜ") gives TWIUBCÌ.
Well that's torn it.