Today I successfully installed MySQL 3.51.30 on local computer running Win7/32bit and codepage windows-1250, where is Apache 2, MySQL 5.5.12 and PHP 5.4 and VFP9. I created MySQL database with character set utf-8, collation utf_general_ci. After that I made small plain VFP form with update-able view using:
I wrote few records into MySQL table from this VFP's form where some fields contained national (diacritics) characters and records were inserted into table without hassle. I made few time connect/disconnect, I was flipping through the records left and right and characters showed as they was when I wrote them. Then, I made PHP script, saved it encoded as UTF-8 and I wrote also in header
but national characters appeared wrong, like as they looks odd in table preview of some MySQL management software (MySQL Fornt or phpMyadmin). I tried to solve it by changing encoding of PHP-script in meta-tags and/or saving as encoded file (ANSI, UTF8) but w/o success. Then I tried to add a option in connection string: charset=UTF8, but records with national chars now appeared incorrectly in VFP form, and if I try then to add even single national char into any form's field then ODBC reported error:
and 4 buttons: Cancel, Suspend, Ignore and Help. What ever I push there is no way to close view nor make exit from VFP except by using Task manager . Now I don't know what kind of encoding to pick in order to make national characters is displayed correctly in VFP forms and in PHP scripts too under running Win7 (code page windows 1250)!? Is there some kind of conversion during update from VFP or before loading data from MySQL table? I don't have a idea what thing caused such behavior of VFP & PHP? Is here some members who had similar problems with displaying and recording national characters? Some conclusion for share? Thank you in advance.
There is no good nor evil, just decisions and consequences.
Code:
lcStringConn="Driver={MySQL ODBC 3.51 Driver};Server=&lcServer;Port=3306;Option=16384;Stmt=;Database=&lcDatabase;Uid=&lcUser;Pwd=&lcPassword"
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="hr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="hr" />
</head>
but national characters appeared wrong, like as they looks odd in table preview of some MySQL management software (MySQL Fornt or phpMyadmin). I tried to solve it by changing encoding of PHP-script in meta-tags and/or saving as encoded file (ANSI, UTF8) but w/o success. Then I tried to add a option in connection string: charset=UTF8, but records with national chars now appeared incorrectly in VFP form, and if I try then to add even single national char into any form's field then ODBC reported error:
Code:
Connectivity error:[MySQL][ODBC 3.51 Driver][mysqld-5-5-12] Incorrect string value: '\xE6 ...' for column 'lastname' at row 1
There is no good nor evil, just decisions and consequences.