0

I have a script which imports data from a CSV file to a mysql Database;

the CSV has strings like this

somethingcô-SOMETHING

see the ô,

now when i import this to the DB it only saves the "something" part only.

I was trying out many things, htmleitities, mysql_real_escape_string etc, but non of them converted the string to UTF-8.

I was trying to manually escape, using a huge array of Special characters and then i found out that then reading the file "ô" doesn;t read as "ô" but something else.

any help on this will be grand

nivanka
  • 1,352
  • 6
  • 23
  • 36

1 Answers1

0

Two things spring to mind here

  1. What collation are you using on the table in question?
  2. Using data of this nature coming in to your DB from the outside world is always risky. Why not just take the raw string that comes in and base64_encode it prior to storage? Needless to say when you want to work with that string you will have to base64_decode it first.
DroidOS
  • 8,530
  • 16
  • 99
  • 171