0
votes

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:[email protected]?subject=feedback">email</a><br>
  <a href="tel:0000000000">Phone</a>
  <br>
  <hr>
  <h3>Send Me a Message:</h3>
  <form class="" action="mailto:[email protected]" 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

1

1 Answers

0
votes

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/