Subject Re: [firebird-support] UTF8 in Blob, subtype Text & IBObjects
Author Martijn Tonies
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.

However, on VARCHAR it works just fine, so what's the deal here?

> 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;

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Sybase
SQL Anywhere, Oracle & MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com