£ sign getting messed - encoding problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: £ sign getting messed - encoding problem (/showthread.php?tid=33171) Pages:
1
2
|
£ sign getting messed - encoding problem - El Forum - 08-17-2010 [eluser]Xarren[/eluser] Hey, Im currently having a problem submitting pound signs to my database. My database collation is UTF-8, and so is my "Content-Type text/html; charset=utf-8". Yet whenever I submitted a £ sign I would end up with a ? mark sign. I realised I needed to encode my data. Having done so however, created an all new problem. All other characters seem fine now (as far as I have tested), however the £ sign is now entered into the database as "£". Im really confused by this, as as far as I am aware all my processing is done using UTF-8, and my pages are served up in UTF-8, so I can't see why that problem would occur. Any ideas on how to fix this? My model: Code: function update_girl($id) PS: I've also tried Code: $decoded = str_replace('Â','',$decoded); £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]InsiteFX[/eluser] Run PHPMyAdmin then click on your database then operations tab and see what your database collation is! Should be set to utf8_unicode_ci InsiteFX £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]Xarren[/eluser] I had it on UTF-8_bin, changed it to unicode_ci, while at it changed the table collation + field collations (stupidly I went through every field, before realising that I only need to do one to test if it works, joy ) - That was no good still doing exactly the same thing. Thats my header loaded before each file, just putting it here to confirm that my header-content command is correct.. It displays just fine when I look at the response in FireBug: Code: <?php header('Content-type: text/html; charset=utf-8'); ?> How frustrating, never had this problem before, I assume that the only explanation is a misconfigured database, but I've spent the whole day staring at my config, going through each bit trying to work out at which stage the encoding is messed up. Are there any tools to view POST data, so that I can have a look whether my form is posting the correct value? Got to love when stuff like this happens on a project which was meant to be ready yesterday . £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]InsiteFX[/eluser] Code: <head> Try that InsiteFX £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]Xarren[/eluser] That didnt help Here are my mysql variables. I have no clue where to change the ones which are not on UTF, nor what "Global" means, could you advise me please if any of this may be causing the problem? Code: character set client utf8 £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]eokorie[/eluser] Can't you not just use Code: £ £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]Xarren[/eluser] Sorry.. Cant I use what instead of the typical £? £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]eokorie[/eluser] Code: £ £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]InsiteFX[/eluser] You need to change the database collation it is set to latin1 PHPMyAdmin Select your database then click on the right top tab operations on that screen at the bottom you will see your database collation change it to utf8_unicode_ci When you create any new database MySQL defaults to a collation of latin1_swedish_ci InsiteFX £ sign getting messed - encoding problem - El Forum - 08-18-2010 [eluser]Xarren[/eluser] Ahh, no I can't - Its for the content management system, telling all the users to suddenly start using £ wouldn't go down too well, that would just be taking the piss out of my employee really, giving him a website and telling him "Oh btw this and this doesnt work here, you ll need to tell all your members that, do you want me to make a big bright alert box telling your members that your website doesnt work? " |