1. Paul Bungert
  2. PowerBuilder
  3. Thursday, 5 March 2020 08:22 AM UTC

Hello,

I have a problem with different encoding behavior of special characters (e.g. äöüÄÖÜß) and empty lines when using different versions of RichTextEdit.

The goal is to convert the content of a RichTextEdit to HTML such that it can be send as a formatted email.

To do that, I use the SaveDocument function of RTE.  According to the documentation only the default EncodingANSI! is supported for FileTypeHTML!. I then read the saved HTML file back in.

With the “Built-in Rich Edit Control” this works just fine.

However, the documentation “highly recommends” using the “Built-in TX Text Control” component which is enabled by default. We would like to use this component.

Using this, the encoding of special characters and empty lines is not maintained. The following example illustrates what is happening:

Input to RTE:

“Test

 

Test äöüÄÖÜß”

With “Built-in Rich Edit Control”:

“Test

 

Test äöüÄÖÜß”

With “Built-in TX Text Control”:

“Test

 

Test äöüÄÖÜß”

 

Miguel Leeuwe proposed a workaround for RTE-to-HTML-conversion using Word in this post: https://community.appeon.com/index.php/qna/q-a/what-we-really-need-is-a-html-editor

Unfortunately, this is not an option, as Word is not installed on every computer that uses this functionality.

 

Am I missing something obvious here?

One issue could be that the temporary HTML file that is generated is specified as UTF-8 and not ANSI:

 <?xml version="1.0" encoding="UTF-8" ?>

[…]

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

[…]

 

Thank you for your help.

 

Cheers,

Paul

Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 5 March 2020 12:23 PM UTC
  2. PowerBuilder
  3. # 1

Please open a support ticket.  We are working with Text Control to bring an updated version of the RTE for PB 2019 R3.

Comment
  1. Paul Bungert
  2. Thursday, 5 March 2020 13:53 PM UTC
Thank you for your response.



This is the support ticket I opened:

https://www.appeon.com/standardsupport/track/view?id=4226
  1. Helpful
  1. Armeen Mazda @Appeon
  2. Thursday, 5 March 2020 14:01 PM UTC
Great, thanks.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 9 March 2020 16:13 PM UTC
  2. PowerBuilder
  3. # 2

Hi Richard;

  Update: While The RTE Control's SaveDocument () command supports an HTML option. When the TX control is selected to run the RTE processing in behind the scenes, it writes the HTML file in ANSI format. When the TE control is selected for RTE support, the SaveDocument() command for HTML writes the file in UTF-8 format. Hence, why the HTML extended characters work in TE mode and not TX mode.  HTH

Regards ... Chris

Comment
There are no comments made yet.
Mark Lee @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 10 March 2020 02:27 AM UTC
  2. PowerBuilder
  3. # 3
Hi Paul,

Thanks for reporting this problem.
I can reproduce it on our side with Windows 10 Version 1909 using PB 2019 Build 2170.
And after I deeply analyzed it, I found that it is not an RTE control issue because the encoding of the newly saved HTML file is UTF-8, which is not ANSI format as we think when we use the savedocument function to save as an HTML file (see attachment 1).
I also checked this feature in PB 12.5 in window 7 and found that it has the same behavior as well.
So I changed my test case code and used the fileopen function with streamMode argument to read the HTML file, and then I got the correct data (see attachment 2).
It seems that the special characters (e.g. äöüÄÖÜß) are also using UTF-8 format instead of ANSI format.
Please let us know if the following code works for you:

Blob                       lb_data
ll_num = fileopen(ls_file, streamMode!, Read!)
filereadex(ll_num, lb_data)
fileclose (ll_num)
ls_data  = string(lb_data , EncodingUTF8!)
messagebox("ls_data", ls_data )

 

Regards,

 

Attachments (2)
Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.