I have to write formatted texts in the PostgreSQL database, when I load RichEdit it shows the normal text, but when I save and I will look in the database the characters look like this:
屻 瑲 ㅦ 慜 獮 屩 湡 楳 灣 ㅧ 㔲 尲 敤 晦 笰 晜 湯 瑴 汢 屻 て 晜 睳 獩 屳 灦 煲 尲 捦 慨 獲 瑥 ‰ 慃 楬 牢 㭩 筽 晜 就 湦 汩 晜 档 牡 敳 ぴ䌠 䑉 潆 瑮 䘫 㬳 筽 晜 尲 湦 汩 晜 档 牡 敳 ぴ 䌠 䑉 潆 瑮 䘫 㬵 筽 晜 尳 湦 汩 晜 档 牡 敳 ぴ 䌠 䑉 潆 瑮 䘫 㬴 筽 晜 尴 湦 汩 晜 档 牡 敳 ぴ 䌠 䑉潆 瑮 䘫 㬷 筽 晜 尵 湦 汩 晜 档 牡 敳 ぴ 䌠 䑉 潆 瑮 䘫 㬸 筽 晜 尶 湦 汩 晜 档 牡 敳 ぴ 䌠 䑉 潆 瑮 䘫 㬶 筽 晜 尷 湦 汩 晜 档 牡 敳 ぴ 吠 桡 浯 㭡絽 屻 潣 潬 瑲 汢 㬠 牜 摥 㔲 尵 牧 敥 ㉮ 㔵 扜 畬 ㉥ 㔵 尻 敲 㡤 尹 牧 敥 㡮 尹 汢 敵 㤸 尻 敲 㕤 尴 牧 敥 㥮 尵 汢 敵 㐱 㬶 牜 摥 尰 牧 敥 の 扜 畬 づ尻 敲 㕤 就 牧 敥 㕮 就 汢 敵 ㄵ 尻 敲 つ 杜 敲 湥 尰 汢 敵 㔲 㬵 ൽ 尊 楶 睥 楫 摮 尴 捵 就 慰 摲 煜 屪 慬 杮 〱 㘴 晜 尰 獦 㠱 传 䰠 䍔
In the database I use UTF-8 and in the LATIN1 client, everything works fine except RichEdit
I have no parameter to solve this problem
It follows part of the code for a better understanding of how the data comes into base, the part in question is in 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 viewed at various points in the application.
The idea is to create a TStringStream variable to receive the RichEdit content and convert it to a PostgreSQL-acceptable character
Important: This routine was made a long time with older versions of Delphi, PostgreSQL and Zeos and at the time was the only way you can insert RichEdit content at the base and view understandably