• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Preventing conversion to entities for special characters, e.g. ' and &, when writting to db (utf8 & mysql)

#1
[eluser]Ollie Rattue[/eluser]
Hey,

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?

#2
[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.

#3
[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?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.