Subject Re: [firebird-support] rtf-to-plaintext udf?
Author Urs Liska
Ivan Prenosil schrieb:
> * perhaps the problem can be somewhere else, before assigning
> PlainText property. E.g. do you have correct definition of blob
> structure and get segment function ?
I think so, but I was probably wrong with the place of the crash.
Further test showed the "SaveToStream" function causing the problem
(perhaps directing towards the idea that you are right with your
comments below)
> * the blob can be potentially segmented, so you need to call
> getsegment in a loop
Ah, this looked a little bit strange to me too. But I used a tutorial on
blob udfs directly from borland, so I thought it should be correct...
> *
>> result := ib_util_malloc(length(rtf.text) + 1);
>> ZeroMemory(result, length(rtf.text) + 1);
>> result := resultString(PChar(str.dataString), str.Size + 1);
> are not you overwriting the pointer allocated by ib_util_malloc ?
That's right. I changed this already but it didn't help.

> * TRichEdit is visual component, which is probably not much good for
> use in UDF.
That's what I think also. But I didn't find any working solution yet
(e.g. a ready-to-use rtf parsing component (or better: function)). To
create one myself seems not feasible because it's not only about
stripping the formatting tags but also to replace all escape characters.

> * it is many years since I worked with rich edit component, so I
> already forgot the problems I had with it, but perhaps you can find
> some useful info here
Thanks for the tip, unfortunately nothing of special interest there

> * I would parse plain text fields in UDF, but convert more complex
> formats to plain text on client. You may want to support more kinds
> of data later, like Word documents, and calling any Word functions in
> FB server using UDF is not a good idea ...
Good point. I think I will go in this direction.
But how can I take care that only plain text gets into the relevant
fields of the database.
Do you think it is enough to document it, so any application developer
(who might be dealing with my db in future) will do as necessary?

Thank you for the comments
> ----- Original Message ----- From: "Urs Liska" <firebird@...>
> To: <> Sent: Friday, January 28,
> 2005 9:32 PM Subject: [firebird-support] rtf-to-plaintext udf?