0

I have a MYSQL table with a single column. The database, table and column collation are set to: utf8_general_ci.
Using a browser, I insert strings in that field. If I insert chars like: şţăîâ or ŞŢĂÎÂ, it is inserted ok. I can see them ok using Phpmyadmin.
My problem is when I want that table in Visual Fox Pro.
I'm using this:

conn_str="Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=database_name;User=user_name;Password=pass;Option=71305256"
conn=SQLSTRINGCONNECT(conn_str)    

SQLEXEC(conn,"SET CHARACTER SET utf8")
SQLEXEC(conn,"SET COLLATION_CONNECTION='utf8_general_ci'")

SQLEXEC (conn,"select * from table_name","Cursor")

But in the vfp cursor, strings like şţăîâ appear like ???îâ
Any help please?

Herb
  • 636
  • 1
  • 15
  • 29
gavroche
  • 249
  • 3
  • 12

2 Answers2

1

I think you have to change your MySQL to some ANSI charset like CP-1252, because visual frox pro does not seem to support utf-8. See What's the problem with Unicode support in Visual FoxPro

smartmeta
  • 1,149
  • 1
  • 17
  • 38
  • That is not the case. If I use a Visual Fox Pro form to insert chars like ŞŢĂÎÂ or şţăîâ they are inserted ok. Also if I read the data from mysql into Visual Fox Pro form the chars appear like they were inserted (just fine). The problems only appear when chars are inserted via web browser. – gavroche Mar 05 '13 at 12:54
  • What is the charset of the webpage? Check your settings and verify it in your browser. (page encoding or something like that) – smartmeta Mar 06 '13 at 06:55
  • Page encoding is ok since the chars are inserted ok via web browser – gavroche Mar 06 '13 at 17:22
0

You need to convert strings to binary . e.g :

SQLEXEC(conn,"select cast(lastname as binary) as lastname from table_name","Cursor")
Swati
  • 28,069
  • 4
  • 21
  • 41