0

Happy New Year.

I need some help with basic HTML form with an mailto action. I have this basic HTML code:

    <!DOCTYPE html>
<html dir="ltr">
<head>
  <meta charset="utf-8">
  <title>Contact</title>
</head>

<body>
  <h1>My contact information:</h1>
  <a href="mailto:XXX@gmail.com?subject=feedback">email</a><br>
  <a href="tel:0000000000">Phone</a>
  <br>
  <hr>
  <h3>Send Me a Message:</h3>
  <form class="" action="mailto:XXX@gmail.com" method="post" enctype="text/plain">
    <label for="Name">Your Name:</label>
    <input type="text" name="Name" value=""><br>
    <label for="email">Your Email</label>
    <input type="email" name="email" value=""><br>
    <label for="Message">Your Message:</label><br>
    <textarea name="Message" rows="10" cols="30"></textarea><br>
    <input type="submit" name="Save">
    <hr>
    <a href="index.html">Home</a>

</body>

</html>

When someone clicks on the submit button a new email is opened with the form data. The problem is that if the submitter use Hebrew character I get some gibberish text instead (tested with gmail as the submitter email client):

This is what the submitter see in the new email popup while clicking on submit and using Hebrew characters:

the email popup

The text circled with red line is the Hebrew text submitted via the form.

I tried adding a charset="utf-8" and also accept-charset="utf-8" to the form - but still the same. I searched google and also in here but didn't find a solution.

Can you please help a newbie? Regards, Ram

Ram
  • 11
  • 6

1 Answers1

0

There are a few Stack Overflow threads that summarise and complement the issue:

Gmail API not respecting UTF encoding in subject

mailto special characters

Printing Hebrew UTF-8 produces giberish

Basically, there isn't anything you can do in HTML to fix this. You would have to replace the way the HTML is being processed, not the code itself. The way you're doing it, it will use whatever client is the user's default, so it's out of your hands.

If you choose to process it however, I suggest a sub-link within that first link:

https://ncona.com/2011/06/using-utf-8-characters-on-an-e-mail-subject/

Darvek
  • 13
  • 4
  • Hi. Thanks for the information - I actually read those links before asking my question here. So if I get this right - there isn't anything that I can do in HTML to fix this - right? the problem is with the email client and not in the form code? – Ram Jan 04 '21 at 09:31
  • Yup, exactly! As unsatisfying as that answer may sound, I fear it is the case. At least you won't be banging your head against this unnecessarily. The funny thing is, that if you send yourself a message in Hebrew through gmail itself, it obviously works just fine, so I have no idea why they can't implement that for "mailto"... – Darvek Jan 04 '21 at 12:27