Welcome Guest, Not a member yet? Register   Sign In
Preventing conversion to entities for special characters, e.g. ' and &, when writting to db (utf8 & mysql)

[eluser]Ollie Rattue[/eluser]

I am having a few issues with charsets and mysql. If I enter "a second set of test's for entity & issues" in a input field which is then inserted into a db I end up with "a second set of test's for entity & issues".

The db collation and charset is set to utf8 unicode. So thats all fine and I except it to work like that and this is normally useful as printing anything pulled from the db in a webpage will display correctly.

However I need to be able to export the data to csv/excel spreadsheet and Phpmyadmin will leave the entities in there when it extracts. If i enter something like "i can && '''''''''''' " via phpmyadmin it stores the values without the entities which makes me think that this is a php/ci encoding before it reaches the db.

How can I prevent values such as & and ' being converted to an entity?

[eluser]Ollie Rattue[/eluser]
As a follow up it is as if it is being run through htmlentities() before being saved into the db. I don't know if this is just what happens normally with utf-8 or whether ci or some setting I have is doing this.

[eluser]Ollie Rattue[/eluser]
Finally I am using the active record class. Would this be converting human readable characters to entities before saving to the db?

Theme © iAndrew 2016 - Forum software by © MyBB