« Version 10 | Home | Special Plugins for y… »

SQL Plugin and Textencoding


As you may know we have a SQL plugin for REALbasic. Whether you should use the database plugins coming with REALbasic or the MBS REALbasic SQL Plugin is a good question and it depends on what you need. Some prefer our plugin because of stability or for more features like bulk record reading or better blob handling.

For the text encoding, if you have trouble, you should check a few things:
  1. What native text encoding does the platform has the database server is running on?
  2. What text encoding is the database server using for storage?
  3. What text encoding does the database API use for clients over network?
  4. What text encoding do you use for query strings?
  5. What text encoding is set for the C library?

For 3 you should check the database manual. For example mysql can be configured to use ISO Latin 1 text encoding which will make trouble if you store Asian characters.
For 4 you may need to make sure that all text sent to the plugin has a known encoding. Internally the plugin converts text to UTF8 or Unicode and later into the encoding the database client needs.
For 5 you should look on a call like SQLGlobalsMBS.Setlocale(0,"UTF8") because that changes the text encoding conversion functions the plugin uses.

But once everything is setup correctly you can enjoy a nice and stable database access.
14 12 09 - 10:18
one comment

Of what I have learned so far, the ODBC driver is oine of the trickiest part in Windows since it’s not very well documented. So even if you make sure that your database is UTF8, you can be almost sure that the ODBC will ‘drop’ it back to Latin1 (or whatever is the encoding in your Windows). This has been a big challenge in some countries where there are several official regional codes, such as Estonia. If you intend to ship your product to different countries, it may be a good idea to include a utility that will allow the user to see whether encoding is kept correctly. This could be simply an additional table that contains all the characters and then a window that displays them in assumed UTF8.
Timo Ruohomäki (Email) (URL) - 19 12 09 - 10:06


  
Remember personal info?

Emoticons / Textile


Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.