PHP storing user entered MS Word characters incorrectly into MySQL -
my web site generated php , javascript , mysql database. i'm developing , debugging code eclipse helios.
i'm trying fix form should work correctly when users cut , paste micsosoft word.
php should save text mysql database entered, , want sanitize upon retrieval database.
retrieving , sanitizing seems work fine. however, text stored in database different entered.
for example, when enter "baño", gets stored "baño"
i stepped thru code debugger, , can see sql code generated as:
insert table1 set column1 = 'baño'
the next step is:
if (!mysql_query($sql, $db)) { ...
if database using phpmyadmin, or retrieve php, see value of column1 'baño'
mysql uses latin1_swedish_ci default, , tried changing utf8_unicode_ci, , utf8_bin, there no difference.
similar code works correctly on other databases.
what doing wrong?
===================
added:
this big web site on 100 php files , js files. database server has 20 databases , in them few hundred tables.
my problem happening in 1 php file , 1 table. no other code writes table, , files doesn't write other table.
here's info phpmyadmin:
mysql server: localhost via unix socket server version: 5.1.43-log protocol version: 10 user: root@localhost mysql charset: utf-8 unicode (utf8) web server apache/2.2.3 (unix) mod_ssl/2.2.3 openssl/0.9.7b zend core/2.0.1 php/5.2.1 mysql client version: 5.0.27 php extension: mysql phpmyadmin version information: 3.3.7
use
mysql_query('set character set charset_name');
before doing query.
also, version of phpmyadmin using? @ header in html source , make sure it's utf-8.
Comments
Post a Comment