Hi,
I'm using the strtoupper function to convert a string to upper case. The string in this case features a foreign language character:
ú
When I output the string this character remains lower case whilst those aorund it are upper case. If I manually post in the uppercase character it correctly displays an uppercase.
I am wonderiing if this has something to do with the charset in the HTML heading?
Rob.
strtoupper
Moderator: General Moderators
-
cpetercarter
- Forum Contributor
- Posts: 474
- Joined: Sat Jul 25, 2009 2:00 am
Re: strtoupper
No, it is to do with the locale set by the operating system of your computer.
Have a look at the php manual entry on strtoupper, particularly the user comments, several of which suggest workrounds for cases where you want to convert non-standard characters to upper case.
Have a look at the php manual entry on strtoupper, particularly the user comments, several of which suggest workrounds for cases where you want to convert non-standard characters to upper case.
Re: strtoupper
It's likely all you need is mb_strtoupper()
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: strtoupper
Thanks for the rpely.
mb_strupper removed the charachter entirely!
Rob.
mb_strupper removed the charachter entirely!
Rob.
Re: strtoupper
Did you supply the correct encoding to mb_strtoupper?
If you tell mb_strtoupper that your string is utf-8, but it's really windows-1252 ansi for example, it may remove foreign characters because they're simply invalid bytes when interpreting the string as utf-8.
If you tell mb_strtoupper that your string is utf-8, but it's really windows-1252 ansi for example, it may remove foreign characters because they're simply invalid bytes when interpreting the string as utf-8.
-
spacebiscuit
- Forum Contributor
- Posts: 390
- Joined: Mon Mar 07, 2005 3:20 pm
Re: strtoupper
Fantatic that did it! I had to set the encloding to Windows-1252.
Many thanks!
Rob.
Many thanks!
Rob.