I have an email template written in html in ckeditor .
I am downloading the template and saving it in UnicodeString;
I am trying to load it to WPRichText like this:
UnicodeString body; // here the html is stored.
WPRichText1->Clear();
WPRichText1->DefaultIOFormat = "HTML";
WPRichText1->TextLoadFormat = "HTML";
WideString wideStr = body;
WPRichText1->LoadFromString(wideStr);
It works ok for Latin based alphabets.
But for Russian I get some problems, the string are replaced and I get something like this :
!?0A81> 70 0H5 1@>=8@>20=85 =0 2 G5;>25:(0) 2
If I cast it to AnsiString I get all russian chars replaced with question marks ???
I also tried WPRichText1->SetUNICODE(body) it gives plain text.
I also tried saving the template to file and loading it with LoadFromFile:
1. In this case it loads the html as plain text, as source code.
TMemoryStream *stm = new TMemoryStream();
stm->WriteBuffer(body.c_str(),body.Length());
stm->Seek(0,0);
stm->SaveToFile("c:\\test.html");
WPRichText1->LoadFromFile("c:\\test.html");
2. In this case it loads the html view for latin based alphabets, but for russain I get chars replaced with question marks.
TMemoryStream *stm = new TMemoryStream();
stm->WriteBuffer(AnsiString(body).c_str(),body.Length());
stm->Seek(0,0);
stm->SaveToFile("c:\\test.html");
WPRichText1->LoadFromFile("c:\\test.html");
For whatever reason I don't think is capable of loading Unicode chars.
Does anyone have a idea on how to fix this.
Thanks,