News:

Support the VirtueMart project and become a member

Main Menu

getUserFieldsFilled Bug for mail encoding form values

Started by Studio 42, February 22, 2017, 16:10:45 PM

Previous topic - Next topic

Studio 42

HI devs,
I had another problem in last beta 3.0.19.6
all char are encoded and this are not render properly in the mails.(é à ù ...) and display HTML chars

in YOURSITE/administrator/components/com_virtuemart/models/userfields.php
function getUserFieldsFilled
i changed htmlentities to htmlspecialchars and all is working perfect for me.
line 794
            // if ((!empty($valueN)) && (is_string($valueN))) $valueN = htmlentities($valueN,ENT_COMPAT, 'UTF-8', false);
            if ((!empty($valueN)) && (is_string($valueN))) $valueN = htmlspecialchars ($valueN,ENT_COMPAT, 'UTF-8', false);

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Jörgen

Thank You Patrick !

Thought it was my email that was at fault :)

Funny enough, this just gave strange chars with the address fields not with the order items. But now it works.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

You need to thanks my customer that paid me , not me ;)

Jörgen

Give him/her my best regards  :)

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Milbo

The whole thing was added for editors. I just wonder why the double_encode param does not work as expected. Setting double encode to false should prevent problems like this.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

Joomla use UTF-8 and email to, so only special HTML char have to be encoded, to not break HTML. htmlspecialchars  is the exact function to do this.

betterlead

Live site runs on Joomla 3.9.24 & VM 3.8.6 10373

PHP: 7.3.26

stAn99

hello, it would nice if the source code of the email is provided included the headers and everything related.

there are many ways how email encoding can get broken, epecially if the email is rendered against utf8 and antivirus, smtp milter or email client is not capable of detecting the utf8 encoding and renders it as win-XXXX code page or else.


as far as i read the difference:
http://stackoverflow.com/questions/46483/htmlentities-vs-htmlspecialchars

htmlentities encodes utf8 special chars as well, whereas the htmlspecialchars does not.

in both cases they should get translated into utf8 by email clients as far as proper email headers are set (which usually aren't as far as i know by default in phpmailer).

also it would be nice to know what email client was used to render the email since there are known bugs in software such as "Outlook Express" that are not capable of displaying utf8 characters.

changing to htmlspecialchars is an option, but does not really solve the problem.

best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

stAn99

ok, i tested this on the very latest VM build which still got the orignal function and my email code looks like this:

after received (modified by eset)
www.rupostel.com/svn3/email.txt
before received (directly from maildir folder in postfix... )
www.rupostel.com/svn3/email_at_server.txt

the special characters are displayed properly on thunderbird and gmail.

i did not test any microsoft products...

my server adds DKIM singnature
and my client adds Eset singature

best regegards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

stAn99

ok, i've put the standard email into the validator here:
https://www.htmlemailcheck.com/check/

and there are some problems:
1. Missing "Content-Type" meta tag  (thus some email clients cannot properly parse the special chars, this should be added to the email tempalte:
<meta http-equiv="Content-Type" content="text/html charset=UTF-8" />
2. Not all special chars are converted to htmlentities
3. No !DOCTYPE declaration found  (this again tells the email client if the document is XML valid or not... )
4. (for more errors see the link above and your email source code... )
5. Possible HTML comments found (HTML comments can increase the risk of an email being flagged as spam with webmail services such as Gmail and Yahoo! If you have included commented HTML to target Outlook email clients, then you can ignore this warning. )

and this was all tested on a standard email themes in Virtuemart.

best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Studio 42

Hi Stan, the change only work if your server send it correctly.
This is only the text part and most eMail server should work.
On checking your email.txt file some other part are not right too and this cannot be fixed using this change because i mean that Joomla always send all as UTF-8.

Studio 42

1. Missing "Content-Type" meta tag  (thus some email clients cannot properly parse the special chars, this should be added to the email template:
Is not a problem, it's set in the header itself. Try to check your email source
This is what i see in my case:
QuoteContent-Type: multipart/mixed; boundary="b1_41ca6884396f8137b4d71377817802cb"

--b1_41ca6884396f8137b4d71377817802cb
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit