Problem with pound (£) in MySQL AR insert statements |
[eluser]Derek Jones[/eluser]
What's the character set being delivered by the server and web page? Your database table is latin1, an odd choice, IMO, but I suspect you're just criss-crossing character sets. If you have a link to the page with the output, that would be helpful to someone wanting to assist you in confirming or ruling that out.
[eluser]Max_Power[/eluser]
OK. I've set up a test page at http://maxpower.plus.com. The output is currently two data columns - opt and value, which are displayed in a for-each loop. Cheers! Just adding an input field...
[eluser]Derek Jones[/eluser]
Your server appears to be forcing utf-8 headers - if I set my browser to view that page as utf-8, it displays properly. You could have that disabled, but you'd be better off to convert your database to utf-8 and use utf-8 exclusively throughout your application and site.
[eluser]Max_Power[/eluser]
Thanks for that. I set up this test with UTF-8: Code: CREATE TABLE IF NOT EXISTS `test` ( Still doesn't return the GBP symbol correctly...
[eluser]Derek Jones[/eluser]
Yes, but what are your charset and collation settings in your CI db driver?
[eluser]Max_Power[/eluser]
Sorry! They are in UTF-8 as well: Code: $db['default']['char_set'] = "utf8";
[eluser]Derek Jones[/eluser]
I would see if it makes a difference if you enter the data via a utf-8 encoded web page from a form. Say, from phpMyAdmin with utf-8 selected, or CI's deprecated-but-still-exists scaffolding. And for certain, I'd ask the server admin to disable the feature of forcing a character set, and construct proper HTML output including a meta tag defining the correct character set. At it's base, what you have is a simple problem of multiple points not communicating to each other in the same character set, but if your configuration is set properly, CI really isn't involved there.
[eluser]Max_Power[/eluser]
Bang on! Thanks for your help. In my main app I set the character set to iso-8859-1 probably from copying and pasting some old code. I was using phpMyAdmin (which was fine) and I double-checked the scaffolding which was also having no problems. Using utf-8 in my header now and all is well. Thanks again - you're a star!
[eluser]Derek Jones[/eluser]
Glad we could help, Max_Power, and welcome to the community! |
Welcome Guest, Not a member yet? Register Sign In |