1
I’ve tried almost everything.
I have a system in Delphixe6 with Postgresql, in it I have some Text type fields that I need to record formatted text (bold, italics, background color, etc) like word, it works blz, except the following, when I write the text for the first time it writes correctly, but if I edit the text it records a lot of ??????????????????? interrogations messing up everything. The way I load 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 records in a good, but the formatted mess with ?????????????
Damn time I went to choose Richedit to save texts, but this system is many years old and at the time was what I had option, the base is already loaded with these texts and can not edit everything and turn into html
I need a tip on how to work with Richedit and not have that problem
I have tested many types of Charsets today use UTF8, which should solve the problem but not solved.
Yeah... I’m screwed I used Text field to store the source code of Richedit thinking it was HTML, but Richedit brings a lot of junk together in memory and these sticks... I’ll have to think of a strategy, are very important documents already recorded
– Marcelo
Gives a searched for Text2bytea that will find some methods to perform field conversion or open another topic here in SOPT.
– Marcio Rodrigues