Using this walkthrough as a jumping off point, I would say:
First
...verify that your application is emitting the Content-Type: text/html; charset=utf-8
header. There's really no reason not to, and it's really simple.
Next
...the first place you may have a real issue is your form. Again referencing the above link the encoding to be used for application/x-www-form-urlencoded data is practically undefined.
Make sure your form is using the attribute accept-charset
set to "utf-8"
(accept-charset="utf-8"
).
One More
...If you aren't using a database in here, then there's nothing to do there, but if you ever store this data in a database, that's almost definitely where the mis-encoding is happening.
There's a lot that could go wrong in the database - from connecting, to how the data is stored, to how the data is retrieved. If you are using a database at all to store this data before it is sent back to the browser, take extra care to make sure the database is properly encoding and retrieving UTF-8 text.
Finally
...strtolower
doesn't convert characters not represented by your locale. If your locale is, say, en-US
, your special UTF-8
characters will not be converted, and you'll get an empty string (if there aren't any other characters).
If you were to use mb_strtolower
, you could pass an encoding like: mb_strtolower($summoner, 'UTF-8');
This properly handles special characters.