0
I have to record formatted texts in the Postgresql database, when I load the Richedit shows the normal text, but when saved and I will look in the database the characters so:
屻瑲ㅦ慜獮屩湡楳灣ㅧ㔲尲敤晦笰晜湯瑴汢屻て晜睳獩屳灦煲尲捦慨獲瑥‰慃楬牢㭩筽晜就湦汩晜档牡敳ぴ䌠䑉潆瑮䘫㬳筽晜尲湦汩晜档牡敳ぴ䌠䑉潆瑮䘫㬵筽晜尳湦汩晜档牡敳ぴ䌠䑉潆瑮䘫㬴筽晜尴湦汩晜档牡敳ぴ䌠䑉潆瑮䘫㬷筽晜尵湦汩晜档牡敳ぴ䌠䑉潆瑮䘫㬸筽晜尶湦汩晜档牡敳ぴ䌠䑉潆瑮䘫㬶筽晜尷湦汩晜档牡敳ぴ吠桡浯㭡絽屻潣潬瑲汢㬠牜摥㔲尵牧敥㉮㔵扜畬㉥㔵尻敲㡤尹牧敥㡮尹汢敵㤸尻敲㕤尴牧敥㥮尵汢敵㐱㬶牜摥尰牧敥の扜畬づ尻敲㕤就牧敥㕮就汢敵ㄵ尻敲つ杜敲湥尰汢敵㔲㬵ൽ尊楶睥楫摮尴捵就慰摲煜屪慬杮〱㘴晜尰獦㠱传䰠䍔
In the database I use UTF-8 and in the LATIN1 client, everything works normal except Richedit
I am without parameter to solve this problem
Follows part of the code to better understand how data enters the base, the part in question is in the if (fdm.Salvar)...
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.AsAnsiString);
//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.AsString := fdm.RichStream.DataString;
zqrOrcItenstexto_puro.AsString := fdm.TextoPuro;
zqrOrcItens.Post;
fdm.zConecta.Commit;
end;
FreeAndNil(fdm.RichStream);
Richstream is a Tstringstream variable that is inside a datamodule to be seen at various points in the application.
The idea is to create a variable of type Tstringstream to receive the contents of Richedit and convert in character acceptable by Postgresql
Important: This routine was done long ago with older versions of Delphi, Postgresql and Zeos and at the time was the only way that can insert Richedit’s content into the base and view in an understandable way.
part of the code used to send the contents of the
TRichEdit
to the bank.– Junior Moreira
If you put a
breakpoint
what you can read here:zqrOrcItensTexto.AsString := fdm.RichStream.DataString;
?– Junior Moreira
Displays Richedit text with type formatting characters: {\rtf1 ansi deff0{ fonttbl{ F0 fnil fcharset0 Arial;}} viewkind4 uc1 Pard lang1046 fs20 test par } that is, it shows the correct content to be recorded, because it should actually have this format, but when it lands on the bench and I will look there are the characters of china, rsrs, is something between Zeos and Postgresql for what I see. I’m gonna try another version of Zeos to see, it’s gonna be some bug...
– Marcelo