Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP storing user entered MS Word characters incorrectly into MySQL
    primarykey
    data
    text
    <p>My web site is generated with PHP and JavaScript and MySQL database. I'm developing and debugging the code with Eclipse Helios.</p> <p>I'm trying to fix a form which should work correctly when users cut and paste from MicsoSoft Word.</p> <p>PHP should save the text into MySQL database as entered, and then I want to sanitize it upon retrieval from database.</p> <p>Retrieving and sanitizing seems to work fine. However, the text stored in the database is sometimes different than what is entered.</p> <p>For example, when I enter "baño", it gets stored as "baño"</p> <p>I stepped thru the code with debugger, and I can see SQL code generated as:</p> <pre><code>insert into table1 set column1 = 'baño' </code></pre> <p>The next step is:</p> <pre><code>if (!mysql_query($sql, $db)) { ... </code></pre> <p>If I then look into the database using phpMyAdmin, or retrieve with PHP, I see the value of column1 as 'baño'</p> <p>MySQL uses latin1_swedish_ci as default, and I tried changing it to utf8_unicode_ci, and utf8_bin, but there was no difference.</p> <p>Similar code works correctly on other databases.</p> <p>What am I doing wrong?</p> <p>===================</p> <h1>ADDED:</h1> <p>This is a big web site with over 100 PHP files and JS files. Database server has 20 databases and in them a few hundred tables.</p> <p>My problem is only happening in one PHP file and one table. No other code writes into that table, and that files doesn't write into any other table.</p> <p>Here's the info from phpMyAdmin:</p> <pre><code>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 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload