Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Email encoding

More
10 years 8 months ago #115581 by kema
Email encoding was created by kema
Hello!
When sending out the welcome email for a survey, the encoding isn't correct för scandinavian letters.
I have googled and looked through the forum but so far as I can tell it should work.

I have checked the collation in the database ( = utf8_unicode_ci). I have checked the email.php (= UTF-8).
What's funny is that when I attach a "TOKEN:Attribute" to the header of the email. The token displays valid characters but not the rest of the header.

Running the precompiled-Ubuntu 141126 from bitnami.

Any pointers or hints would be greatly appreciated.

Regards
Kenneth Martinsson
The topic has been locked.
More
10 years 8 months ago #115590 by Mazi
Replied by Mazi on topic Email encoding
Which Limesurvey version do you use?

Can you reproduce the problem at our demo which always runs the latest code?

Best regards/Beste Grüße,
Dr. Marcel Minke
survey-consulting.com
offlinesurveys.com
Feel free to contact me by email for professional LimeSurvey support!
The topic has been locked.
More
10 years 8 months ago #115599 by kema
Replied by kema on topic Email encoding
Hi!

Thanks for the fast response. I'm running 2.05 build 141126.
I tried reproducing it on the demo site, but I cant send emails due to demo-mode.

TOKENS:ATTRIBUTE_1 in the email header is ok and the entire survey is ok, it's just the welcome email, that doesn't display correct.

Another thing is that when i finished my test survey the confirmation email was encoded correctly.

/Kenneth
The topic has been locked.
More
10 years 8 months ago #115601 by kema
Replied by kema on topic Email encoding
Ooh I forgot...
When sending to my personal GMail, it looks ok, but not to my personal outlook.com or to the companys exchange server.

/Kenneth
The topic has been locked.
More
10 years 8 months ago #115603 by Mazi
Replied by Mazi on topic Email encoding
Did you edit the email messages?

If so, try setting it back to the default texts.

Best regards/Beste Grüße,
Dr. Marcel Minke
survey-consulting.com
offlinesurveys.com
Feel free to contact me by email for professional LimeSurvey support!
The topic has been locked.
More
10 years 8 months ago #115638 by kema
Replied by kema on topic Email encoding
Hi Mazi!
Yes I tried that as well without luck!
Gonna give it a new try tomorrow.
/Kenneth
The topic has been locked.
More
10 years 8 months ago #115648 by Mazi
Replied by Mazi on topic Email encoding
Can you forward one of these buggy emails to me (see signature below for email address)?

Best regards/Beste Grüße,
Dr. Marcel Minke
survey-consulting.com
offlinesurveys.com
Feel free to contact me by email for professional LimeSurvey support!
The following user(s) said Thank You: kema
The topic has been locked.
More
10 years 8 months ago #115751 by kema
Replied by kema on topic Email encoding
Update on the issue.
After filing a bug, c_schmitz replyied that he couldn't reproduce the issue.
I'm still trying to find the problem and have now changed mail-server to gmail instead of exchange.
Attached is the smtp debug. So there is no difference if sending through gmail or exchange.
Could it be the receiving mail server that is causing it.
The invite looks ok in GMail but not in MS (outlook.com/Exchange)
The topic has been locked.
More
10 years 8 months ago #115755 by Mazi
Replied by Mazi on topic Email encoding
It is most probably the receiving end which causes the trouble.

Emails can look different at different email clients or web clients.

Best regards/Beste Grüße,
Dr. Marcel Minke
survey-consulting.com
offlinesurveys.com
Feel free to contact me by email for professional LimeSurvey support!
The topic has been locked.
More
10 years 8 months ago #115758 by kema
Replied by kema on topic Email encoding
I think I just found the solution :)
Changing the following in common_helper.php:

//if ($emailcharset!='utf-8')
if ($emailcharset!='iso-8859-15')
{
// $body=mb_convert_encoding($body,$emailcharset,'utf-8');
// $subject=mb_convert_encoding($subject,$emailcharset,'utf-8');
// $sitename=mb_convert_encoding($sitename,$emailcharset,'utf-8');
$body=mb_convert_encoding($body,$emailcharset,'iso-8859-15');
$subject=mb_convert_encoding($subject,$emailcharset,'iso-8859-15');
$sitename=mb_convert_encoding($sitename,$emailcharset,'iso-8859-15');
}

I have tried that in email.php and config.php with the parameter emailcharset
And it's possible that a change in some other file is better. But this seems to work.

/Kenneth
The following user(s) said Thank You: paulorcdo
The topic has been locked.
More
10 years 8 months ago #115761 by Mazi
Replied by Mazi on topic Email encoding
Does that also explain why confirmation emails are sent correctly (do thy use different code)?

Best regards/Beste Grüße,
Dr. Marcel Minke
survey-consulting.com
offlinesurveys.com
Feel free to contact me by email for professional LimeSurvey support!
The topic has been locked.
More
10 years 8 months ago #115762 by kema
Replied by kema on topic Email encoding
Good question. I haven't gotten that far yet. But I can't find any other function in common_helper.php that points to that so I don't know!?
I will try to verify this on my "production system".

/Kenneth
The topic has been locked.
More
10 years 8 months ago #115763 by c_schmitz
Replied by c_schmitz on topic Email encoding
Well, if that fixes your problem it means that your data is originally not saved in UTF-8. You will need to check all tables and each field in the tables again for the right collation.
Did you maybe restore the database previously from a backup using the wrong default collation?

Best regards

Carsten Schmitz
LimeSurvey project leader
The topic has been locked.
More
10 years 8 months ago #115765 by kema
Replied by kema on topic Email encoding
This was a downloaded Ubuntu 14.0.4 virtual machine from bitnami with preinstalled Limesurve 141126.

However what I did was to import a *.lss. But I think it was UTF-8 coded.
Not quiet sure. I'm new to both Linux and php so bare with me ;)

I will try to check the tables. From what I can tell in the database backup, default collation is utf8_unicode_ci

/Kenneth
The topic has been locked.
More
10 years 7 months ago #116401 by kema
Replied by kema on topic Email encoding
So...this continues to haunt me.
After the holidays I have downloaded an updated virtual appliance (Ubuntu 14.04 from bitnami). Running it and it works.
Deploying it on an ESX server in DMZ. Browse to the application and bam... there it is the problem again WTF.
So I started thinking..what changed. I accessed the application remotely. Testing it on the newly downloaded virtual appliance and now I can replicate the error.

If I access limesurvey from within the virtual appliance the email is sent with the correct encoding. If I access limesurvey from the "outside" it's sent with the strange charachters instead of å, ä and ö.
Using Chrome from the outside and Firefox from with Linux if it could be of importance.

/Kenneth
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose