Timeline for How do I remove accents from characters in a PHP string?
Current License: CC BY-SA 3.0
10 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Apr 19, 2023 at 20:16 | comment | added | ygoe | @Phil It's not en_UK but en_GB. UK is not the country code of the UK, the TLD .uk is just an exception. The traditional and official name here is still GB for Great Britain. | |
| Jul 5, 2017 at 17:52 | history | edited | Waiyl Karim | CC BY-SA 3.0 |
added 10 characters in body
|
| Jul 28, 2015 at 22:52 | comment | added | mpen |
@Phil_1984_ setlocale(LC_CTYPE,'en_UK');echo iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', "usuario o contraseña incorrectos"); comes out correctly. Do you know how to reliably reproduce the issue?
|
|
| Jul 28, 2015 at 22:35 | comment | added | Phil | @Stan looks like your ñ character isn't proper utf-8. Check your .php file encoding. | |
| Jul 28, 2015 at 22:35 | comment | added | Phil | @Mark Just realised my setlocale command was returning false on my windows. It should be using "en_UK" tho. Maybe a windows bug with my iconv. | |
| Jul 28, 2015 at 17:17 | comment | added | mpen | @Phil_1984_ What's your locale? | |
| Jan 27, 2015 at 23:40 | comment | added | Phil | The iconv UTF8 to ASCII transliterations seem to be very strange. I get "usuario o contrase~na incorrectos" for my locale. It converts things like ñ to ~n and ö to :o I have found that transliterating to latin1 then converting extended ascii manually works best. | |
| Dec 8, 2014 at 21:59 | comment | added | Waiyl Karim |
For your example you could use: setlocale(LC_CTYPE, 'cs_CZ'); echo iconv('UTF-8', 'ASCII//TRANSLIT', "usuario o contraseña incorrectos"); // output: usuario o contrasena incorrectos. Please refer to PHP Documentation for more info. Everything is there! php.net/manual/en/function.iconv.php
|
|
| Dec 8, 2014 at 16:59 | comment | added | Stan |
This is not very reliable echo iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', 'usuario o contraseña incorrectos'); outputs usuario o contrase?a incorrectos
|
|
| Aug 20, 2014 at 21:05 | history | answered | Waiyl Karim | CC BY-SA 3.0 |