I have tried almost everything.
I have a system in DelphiXe6 with PostgreSQL, in it I have some Text type fields that I need to write formatted text (bold, italic, background color, etc.) type word, it works blz, except when I save the text first time it writes correctly, but if I edit the text it writes a lot of ??????????????? questions messing everything up. The way I load the text in the editor is below:
if (zqrOrcItens.RecordCount = 0) then
begin
TFuncoes.pMensagem('Não existem itens na lista para editar');
Exit;
end;
fdm.Salvar := False;
fdm.RichStream := TStringStream.Create('');
zqrOrcItensTexto.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
zqrOrcItens.Edit;
fdm.RichStream.Position := 0;
zqrOrcItensTexto.LoadFromStream(fdm.RichStream); // AsString := fdm.RichStream.DataString;
zqrOrcItenstexto_puro.AsAnsiString := fdm.TextoPuro;
zqrOrcItens.Post;
fdm.zConecta.Commit;
end;
FreeAndNil(fdm.RichStream);
I save the formatted text and the plain text so as not to lose what was typed, the plain text writes in a good, but the formatted mess with ?????????????
Damn time I chose RichEdit to save texts, but this system has many years and at the time was the one that had the option, the base is already loaded with these texts and can not edit everything and transform into html
I need a hint of how to work with RichEdit and not have this problem
I have tested many types of Charsets today using UTF8, which should solve the problem, but it did not solve.