TRVHtmlImporter with Unicode Characters

General TRichView support forum. Please post your questions here
Post Reply
danielpricecds
Posts: 2
Joined: Tue Aug 25, 2020 1:13 pm

TRVHtmlImporter with Unicode Characters

Post by danielpricecds »

Hi,

I am trying to load some html that conatains Unicode characters using the LoadHtml procedure on the TRVHtmlImporter component which seems, when the compilation is unicode enabled, to cast the input parameter to AnsiString which therefore translates the unicode characters to question marks. Any ideas on how I can display unicode characters using the HtmlImporter?

Thanks,
Daniel
Attachments
RichViewTestForm.zip
(1.53 KiB) Downloaded 772 times
Sergey Tkachenko
Site Admin
Posts: 17254
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: TRVHtmlImporter with Unicode Characters

Post by Sergey Tkachenko »

The parameter of LoadHTML is AnsiString. When you pass Unicode string there, it is converted to ANSI, and Unicode characters are converted to ?.
Use this code:

Code: Select all

  RvHtmlImporter1.LoadHtml(UTF8Encode(data));
danielpricecds
Posts: 2
Joined: Tue Aug 25, 2020 1:13 pm

Re: TRVHtmlImporter with Unicode Characters

Post by danielpricecds »

Thanks Sergey, that worked!
Post Reply