UTF8 results from Zeos

Posted on 2006-05-14
Last Modified: 2008-01-09
I need read UTF-8 records from MySQL database using Zeos library (+ TNTstringgrid =unicode stringgrid), but every result looks as ASCII.

Can you tell me, how to set it right?
Question by:LadinT
    LVL 28

    Expert Comment

    1) make sure that the fields in mysql tables are of type utf-8
    2) how do you read the records? what components do you use? are those components utf-8 (unicode) enabled?
    3) how do you pass the records from the components to the zeos components?

    Author Comment

    1) If work with this tables in PHP (some years :-) ), i can write and read it right
    2) I use Zeos library, but i don't know if it is Unicode enabled, i think it is. TNTcomponents are unicode enabled.

    I have set ZConnection Properties set to codepage=utf8
    Non-ASCII character are displayed as two-characters, not as '?'

    I only want describe any example with Zeos, where i can see result in UTF-8

    LVL 28

    Expert Comment

    I never worked with zeos, but I suggest looking at the way you read the records and saving the output to a file. then you can view the file and see if zeos indeed gets the records correctly. if it does, and tnt doesn't show it right, then you found your problem. if it doesn't read them right, then again you found your problem :)

    Author Comment

    If i save it to file, it is correct.

    Output from zeos is as string only, other characters are displayed as sequence 8-bit chars.  
    Can you send me some example for conversion of this string to utf8? Simple conversion is bad, i need convert it as stream... maybe...

    I cannot find something useful...

    Thank You.
    LVL 28

    Accepted Solution

    it's 2:35 am here and I was going to bed :) but I'll tell you what functions to try. if you can't make it work, I'll give you tomorrow a working example to convert utf8 to string and back. also put some of those strings you have trouble with in a file and base64 encode it and paste it here so that  I will have some valid data to test with (there are plenty of base63 encoders out there (totalcommander also has built int)

    so Utf8ToAnsi and AnsoToUtf8 ar the 2 conversion functions.
    considering the output you use, you might need to first convert from unicode to utf8 (or directly to string) using UnicodeToUtf8/Utf8Encode or WideCharToString.

    Author Comment

    It is OK, UTF8decode is my new friend.

    Thank You

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now