Click to See Complete Forum and Search --> : spanish accent in php
prachu
09-13-2007, 04:39 PM
Hi
I am trying to import data into mysql from excel. The issue is that the data has some char with spanish accents. I am writing a php script to do that. When I try to display data containing those accents in php, I get a beta symbol for every char that has an accent on. How can I preserve the accents in php and import it to sql? Thanks
Sheldon
09-13-2007, 05:29 PM
you could try set th char set in php to a spanish one?
put this at the top of the file
header('Content-Type: text/html; charset=ISO-8859-1');
// replace to a spanash char set
prachu
09-13-2007, 05:36 PM
Thanks for your response but that did not work either.. i still get the beta-symbol
I had a list of names that had accents in them and I simply used the mysql_real_escape_string() function and the accents were preserved, but I also believe it has something to do with the char set in the sql server or the field attributes in the sql table.
prachu
09-14-2007, 12:05 PM
So in the mysql table did you set the character set and collation attributes for a column? like
ALTER TABLE t1 CHANGE c1 c1 TEXT CHARACTER SET latin1 COLLATE latin1_spanish_ci;
If you did, I have a question. By doing so would the normal english words in column c1 be preserved? Because my column is basically english text but has only a few words that have accents? any idea? thanks!
My understanding is all these should ensure proper insertion into mysql db. But how can we make sure that php understands the accents? Because php is the one that passes it to mysql right? Even in php i am not able to display the accent chars!