Welcome! Log In Create A New Profile

Advanced

[WD23] Email text problems

Posted by Ola 
Ola
[WD23] Email text problems
August 31, 2020 03:51PM
Hi all,

I'm building an email system for my ERP and have some problems that I hope somebody can help me to solve.

In my email reading window I have two text fields, one for plain text (from email.message) and one for html text (from email.html).

Problem 1:
The html text field is properly filled with the html contents (not always, see below), as it should, but the plain text field has the contents of them both; first the plain text and then the html contents. Furthermore, the plain text is all in one single text mass, so WD obviously cannot convert the LFs and CRs in it.
So, how can I cut the HTML part away from the plain text, and
How can I make the plain text more readable?
Correction: The "furthermore error" was my fault: the "plain text" field was actually defined also as an HTML field. When I changed it to plain text, the line feeds appeared. Actually there are now too many line feeds, which I obviously have to clean away in my conversion code. But the HTML is still there (as HTML code text) after the plain text section...

Problem 2:
In some cases WD cannot convert the extended characters correctly. For instance, when the header has a content type like this:

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
or
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 8bit

the extended characters are coded like below, and they produce only "boxes" in the displayed text:
=C3=A4 (= ä - latin small letter a with diaeresis)
=C3=84 (= Ä - latin capital letter A with diaeresis)

=C3=B6 (= ö - latin small letter o with diaeresis)
=C3=96 (= Ö - latin capital letter O with diaeresis)

=C3=A5 (= å - latin small letter a with ring above)
=C3=85 (= Å - latin capital letter A with ring above)

=C3=BC (= ü - latin small letter u with diaeresis)
=C3=9C (= Ü - latin capital letter U with diaeresis)

Of course I could replace these codes to readable letters, but surely there must be a more efficient way? Is there?
Any suggestions will be appreciated, as always.

Best regards
Ola



Edited 1 time(s). Last edit at 08/31/2020 07:58PM by Ola.
Ola
Re: [WD23] Email text problems
September 01, 2020 02:17PM
Hi all,

My email plain text and html text fields are just strings. If the incoming email is UTF-8 coded, should I then do the UniCodeToAnsi conversion to the contents, when importing them to my email system? Or UTF8ToAnsi?

Best regards
Ola
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: