Hello,
I have a question on string encoding behavior when sending an HTML SMTP message. Here is a description of the workflow:
First, we are reading in an HTML file as a message template. We are also reading a customizable message from a DataWindow from a value stored in the database. We do a Replace to insert the custom message into the template before passing the entire string to the SMTP service.
The issue I'm having is that the resulting email seems to have two different encodings. Both the template HTML file and the custom message inserted into it contain accented characters, but in the received message the custom characters are not displayed correctly, while the template characters are.
Using Notepad++ to switch between UTF-8 and ANSI encodings seems to switch which characters are displayed correctly, which is odd.
Since it is my understanding that PowerBuilder 2021 uses Unicode internally for all processing, how could this be possible? Is there a way to re-encode the string as Unicode to ensure consistency?
Thank you,
Phil
Thank you for sharing that workaround solution that you created!
Yes, I have had ANSI file challenges before too in my PB Past when handling external ANSI files from outside sources.
I had to get a bit creative too on some data massaging. ;-)
We look forward to your further insights in this area.
Regards .. Chris
Using FileOpen with EncodingANSI! and then reading the contents into a blob that you later interpret as UTF8 is also the only way I've found to circumvent the issue with opening non-BOM UTF8 files.