Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi 5, how to retrieve data from MySQL's tis620 fields?

I have a web application written in PHP which using MySQL as database back-end.

To store my language(Thai) data, I'm using tis620 charset on my database tables, this setting is great for my web application at the moment.

I'm going to write a Windows application to access the same database as my web application, but I have faced the problem about retrieving data from tis620 fields.

This is my table's default collation, using tis620

enter image description here

For testing purpose, I setup the eng field's collation to use utf8 enter image description here

I inserted one sample record to the table

enter image description here

I'm using Oracle's MySQL Connector/ODBC 5.1 as ODBC driver, and tried both setup as utf8 and tis620

enter image description here

I'm using Delphi 5, TTable to connect the the database table

  1. field(s) with utf8 can be retrieved
  2. field(s) with tis620 (table's default) cannot be retrieved

    • Although to use Field Editor to create all fields I could get just utf8 field(s).

enter image description here

Please give me some advices, tis620 is best suit to my web application at the moment, if I converted the fields to utf8 I solve this problem but I will have a problem to my web application instead.

So how to use BDE Data Access component (TTable, TQuery) to retrieve data from tis620 field(s)?

Please help.

Thanks everyone.

like image 594
Artisan Avatar asked Jan 25 '26 03:01

Artisan


1 Answers

Did you use "Thai" as your language for Non Unicode applications in your Windows settings? Delphi 5 applications can work very well with Thai and English at the same time. What you can not do out of the box is to mix charsets. But I suspect you do not need full Unicode, just to display some Thai and English content.

Then set the code page Win-874 in your ODBC driver.

Or you can switch from the deprecated BDE to a newer library. If you are stick to Delphi 5, I recommend to test FreeDAC which supports natively:

  • Oracle v 8.0.3 and higher;
  • MySQL v 3.23 and higher;
  • MSSQL v 2000 and higher;
  • MSAccess v 2000 and higher;
  • IBM DB2 UDB v 8 and higher;
  • Sybase ASA v 8 and higher.

Of course, this library is deprecated (in favor to its AnyDAC/FireDAC evolution), but it is AFAIK one of the best solution for Delphi 5. And it is free, with sources. And IMHO it is much preferred to any ADO-based components, in the Delphi world.

If you use FreeDAC, you won't need to configure ODBC (nor the BDE, of course), since it provides direct access to MySQL.

like image 147
Arnaud Bouchez Avatar answered Jan 26 '26 17:01

Arnaud Bouchez



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!