Subject Re: [firebird-support] UTF8 in Blob, subtype Text & IBObjects
Author Minoru Yoshida
Hi Martijn,

"Martijn Tonies" <m.tonies@...>
Mon, 17 Nov 2008 13:37:56 +0100 wrote:
>Hi,
>
>To properly display BLOB subtype Text with UTF8 characters,
>what should be done with regard to fetching blob data and the
>API?
>
>I'm currently using IBObjects which doesn't support this, see:
>http://tracker.upscene.com/view.php?id=1502&nbn=3#bugnotes
>
>Is there something specific IBO should set before fetching the BLOB
>that it currently only does for varchar data?

I think that text draw problem, not IBO core(or API) problem.
This case become correct result with e.g. TMS unicode controls.
It will be possible if unicode controls or ExtTextOutW API.. are used.

My test code:

procedure TForm1.TntButton1Click(Sender: TObject);
var
Temp:TStringlist;
begin

with IB_Connection1 do
begin
Params.clear;
charset := 'NONE'; //IBO 4.8.7: UTF8 charset is using internal ansi
translation.
...
Path := 'c:\w\test.fdb'; //from your test.fbk
connect;
end;

with IB_Cursor1 do
begin
SQL.Text := 'select * from test';

Temp:=TStringlist.create;
try
First;
Next; // Second row (german umlaute data)

TIB_ColumnBlob(FieldByName('TEST')).Assignto(Temp);
TntMemo1.lines.Text := UTF8decode(Temp.Text); //OR
MultiByteToWideChar

//OR TntMemo1.lines.Text := UTF8decode(FieldByName('TEST').
Asrawstring);

finally
Temp.free;
end;
end;
end;

--
Regards,
Minoru