sureshv120 Posted February 8, 2012 Share Posted February 8, 2012 Hello Sir/Maam, I need some help in a problem I am having with spanish special characters. A brief summary of what I am doing first. I have written a PHP script which fetches data from Google Spreadsheet using Zend Google PHP API. This data is then put into MySql database. $row=$Col->getText(); //getText is the Google API that returns the value in the row. print "$row"; // I print the content But the problem is that some spanish characters such as ñer appear as ñer. Later on in the PHP code I go on to save these values in MySql. And even in the tables the same problem.Don't know where the problem is. I tried various different things such as edit the PHP file and add: mbstring.language = Neutral ; Set default language to Neutral(UTF- (default) mbstring.internal_encoding = UTF-8 ; Set default internal encoding to UTF-8 mbstring.encoding_translation = On ; HTTP input encoding translation is enabled mbstring.http_input = auto ; Set HTTP input character set dectection to auto mbstring.http_output = UTF-8 ; Set HTTP output encoding to UTF-8 mbstring.detect_order = auto ; Set default character encoding detection order to auto mbstring.substitute_character = none ; Do not print invalid characters default_charset = UTF-8 ; Default character set for auto content type header mbstring.func_overload = 7 ; All non-multibyte-safe functions are overloaded with the mbstring alternatives Add in the below in MySql init_connect='SET collation_connection = utf8_unicode_ci; SET NAMES utf8;' character-set-server=utf8 collation-server=utf8_unicode_ci skip-character-set-client-handshake Change Database and Table properties ALTER DATABASE db_name CHARACTER SET utf8 DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT COLLATE utf8_general_ci ; ALTER TABLE tbl_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci ; Call SETNAMES etc just after mysql open connection. $q="SET NAMES 'utf8'"; $r=mysql_query($q); mysql_query("SET CHARACTER SET utf8"); But nothing seems to work. Please help Link to comment https://forums.phpfreaks.com/topic/256649-problem-with-spanish-characters-while-using-google-api-php-mysql/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.