0

I'm trying to parse a text file using PHP.

In my database I have data which shows in phpmyadmin like this Triste o melancólico

And once it's retrieved it displays just fine on my website.

Now the issue has come when I try to parse this text file. I will have a word such as Etimología

Now I load the text file, parse it and if I echo the parsed data to the page it will display fine, no question marks / unwanted characters in replace of the í. The thing is if I go to insert the data into my db the special character í is being switched over to a question mark.

I've tried using

mysql_query("SET CHARACTER SET utf8");

After my sql connection but it did not make a difference.

Does anyone have any ideas as to why new text with special characters are being inserted as question marks, when pre existing text with special characters is working just fine?

Thanks

Belgin Fish
  • 19,187
  • 41
  • 102
  • 131

1 Answers1

1

Try some different set in your mysql database for example utf8_general_ci or utf8_unicode_ci only if utf8_general_ci didn't work :

  1. Log to phpMyAdmin. Select the database from the list on the left.
  2. Click "Operations" from the top set of the tabs.
  3. In the Collation box, choose the new collation from the dropdown menu utf8_general_ci is fine but if you have it already and you still have the problem then try to use utf8_unicode_ci maybe it will solve your problem.
  4. Click Go and see if it solve your problem

Hope this will help you.

JustGreat
  • 551
  • 1
  • 11
  • 26
  • That appeared to resolve the issue of new entries but corrupted the display of all the previous entries – Belgin Fish Apr 10 '14 at 01:14
  • And if you set back to previous value the data will get back to what it was ? if yes, it seems you should create a new table with the instructions i gave you above and then you move to it all data from old table. Before you do that, did you try with both utf8_unicode_ci ? and utf8_general_ci ? – JustGreat Apr 10 '14 at 01:20