Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encoding issue in duel of VFP9 & MySQL
Message
From
22/12/2012 09:27:33
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Encoding issue in duel of VFP9 & MySQL
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01560459
Message ID:
01560459
Views:
107
I tried to make a desktop application with MySQL 5 as database storage. In same time I planned to employ PHP-scripts that will read data from used MySQL and display to clients connected in LAN, just like some kind of a info-service. LAN makes few PC running under Win7, Apache 2, MySQL and PHP.
Before few days 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:
lcStringConn="Driver={MySQL ODBC 3.51 Driver};Server=&lcServer;Port=3306;Option=16384;Stmt=;Database=&lcDatabase;Uid=&lcUser;Pwd=&lcPassword" 
I wrote few records into MySQL table by using 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 from VFP, I was flipping through the records left and right but characters showed right as they was when I wrote them. Then, I made PHP script, saved it encoded as UTF-8 and I wrote also in header
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" 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 Front 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, then I changed ODBC to new one but when I try to add or update records with even single national char into any form's field then ODBC reported error:
Connectivity error:[MySQL][ODBC 3.51 Driver][mysqld-5-5-12] Incorrect string value: '\xE6 ...' for column 'lastname' at row 1 
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 A 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.
Reply
Map
View

Click here to load this message in the networking platform