Special Characters NOT displaying properly in javascript MAILTO

Posted on 2009-02-11
Last Modified: 2013-11-19
I have a Javascript mailto function embedded in my web page, whose encoding is set to UTF-8. So the special characters such as characters showing French accent and Chinese characters show up fine on the web page.

However, when I try to use the maito function, the subject and body having these French and Chinese characters get distorted in Outlook

Please see code below. How do I fix this?
mailto function:


function sendEmaill() {

	    window.location.href="mailto:?subject=Votre ami vous a invité à consulter un lien sur le site Web Google&body=On vous a invité à consulter un lien du site Web Google, Cliquez sur le lien ci-dessous pour afficher la page :%0A%0D" + escape(window.document.location);




calling code:


Send to friend: <a href="javascript:sendEmail()">Send a friend</a>

Open in new window

Question by:vgnuser
    LVL 75

    Accepted Solution


    var subject = 'Votre ami vous a invité à consulter un lien sur le site Web Google';
    var body= 'On vous a invité à consulter un lien du site Web Google, Cliquez sur le lien ci-dessous pour afficher la page :\n\n'+window.location.href;
    function sendEmaill() {

    Open in new window

    LVL 1

    Assisted Solution

    I have tryed to use System.Web.HttpUtility.UrlEncodeUnicode and other methods of HttpUtility on the serverside  with aspnet.
    But it did not work when I clicked the link and the mail client starts.
    I used the brutal version proposed here with simple replace.
    He describes the same problem in the comments that I found.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Now-a-days, indirectly, postal services have been replaced by email services. Yes, whenever we hear the word "email" a lot of people only think of gmail. Some people still think that email and gmail are one and the same thing :-). Let's see some …
    Several part series to implement Internet Explorer 11 Enterprise Mode
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
    Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now