I'm asking this question because the days I'm having a huge headache with this RichEdit junk, time it saves correct time it saves a lot of ???????????? in the base ... I know it may be an error in the conversion of characters but the detail is that the problem is intermittent.
If it is the first time I record it it writes correctly
If it's editing it records a bunch of strange, Chinese-type characters.
If I clean the base and insert the text again and save it correctly.
Sometimes in the edit it writes correctly.
I'd like to change everything for HTML but it's not feasible, it's years of writing everything in RichEdit because I need formatted text.
The way I'm doing it goes below:
...
fdm.RichStream := TStringStream.Create(fdm.zqrAux_Aet_TextoDiversas.AsAnsiString);
//fdm.zqrAux_Aet_TextoDiversas.SaveToStream(fdm.RichStream);
f_richedit := Tf_richedit.Create(nil);
fdm.RichStream.Position := 0;
f_richedit.RichEdit.Lines.LoadFromStream(fdm.RichStream);
TFuncoes.pJustRichEdit(f_richedit.RichEdit, False);
f_richedit.ShowModal;
if (fdm.Salvar) then
begin
fdm.zqrAux_Aet_Texto.Edit;
fdm.RichStream.Position := 0;
fdm.zqrAux_Aet_TextoDiversas.LoadFromStream(fdm.RichStream);//AsString := fdm.RichStream.DataString;
fdm.zqrAux_Aet_Texto.Post;
fdm.zConecta.Commit;
end;
FreeAndNil(fdm.RichStream); // .Free;
fdm.zqrAux_Aet_Texto.Close;
f_richedit := nil;
Look at some "commented out" that I tried to save in other ways, but the problem continues
The database is postgresql, but I think it does not even matter, because it writes text and it is UTF8 and everything as it asks the costume
Does anyone know a safe way to work with this RichEdit?
I say safe because right I do not even know, rs