问题
I sometimes have to send emails in a German and I need to use ö ä ß etc... I have text written containing these letter and using alert() they appear just fine. I have code to send an email :
var link = "mailto:" + SendTo
+ "&cc= "
+ "&subject=" + escape(subjectLine)
+ "&body=" + escape(BodyText);
window.location.href = link;
When I click a button to send the email, the text is missing these foreign letters e.g gruß comes out as gru. Do I need to put anything in here to make sure these letter don't disappear?
Thank you in advance
回答1:
The following articles shows how to decode the letters using javascript :
Javascript decoding html entities
function decodeHtml(html) {
var txt = document.createElement("textarea");
txt.innerHTML = html;
return txt.value;
}
HTML Entity Decode
Using jquery:
varTitle = $('<textarea />').html("Chris' corner").text();
来源:https://stackoverflow.com/questions/29005855/foreign-letters-failing-when-sending-emails