11

I'm trying to generate email from my code that will read correctly for people using right-to-left-reading languages such as Arabic. My question is: what are my options for acheiving this?

I am aware that I can create a multipart email and encode the message body as "text/html", then specify a text direction in the <html> tag (e.g. <html dir="rtl">), but ideally I would like use plain-text email and not have to rely on HTML formatting, because not all users will have HTML support in their email client.

On the plain-text front, I have managed to encode Arabic text in UTF-8 using the "Content-Type" header as follows:

Content-Type: text/plain;charset=UTF-8

But as for the overall direction of the text, I am unsure how to explicitly specify this in the email, or even if this is necessary. How would an Arabic speaker typically work with plain-text email? Would they usually rely on the global text direction setting in their email client, or is there some other, generally accepted way of forcing the text direction in the email itself?

Any suggestions or general advice regarding right-to-left email would be much appreciated.

2 Answers 2

5

I am unsure how to explicitly specify this in the email, or even if this is necessary.

For plain-text unicode, you can add a right-to left mark inline, but it's not really needed.

I'd say why not add the RTL mark, but it's not really necessary

How would an Arabic speaker typically work with plain-text email?Would they usually rely on the global text direction setting in their email client, or is there some other, generally accepted way of forcing the text direction in the email itself?

Most users would be able to either switch the text direction to get a correct padding of the lines, or are used to a jagged-right Arabic text (the text itself will appear correctly if it doesn't contain any inline English characters, and users are used to reading it in chunks even if it does).

2
  • But it is not posssible to for example send a plain-text-mail that is aligned to the right side?
    – Gigala
    Mar 7, 2013 at 8:27
  • 2
    Good point about the right-to-left mark, but I disagree that expecting users to manage is OK. The email can become very weird, especially if rtl text is mixed with ltr text ( eg: مرحبا بكم الى موقع stackoverflow.com يا اصدقائي! )
    – Flimm
    Feb 26, 2016 at 12:37
0

I am upvoting Osama's question, even tough I have a very different opinion then him. The reason is that unicode control characters are not used enough in the world, and they could fix a lot of problems.

Anyway, to my answer: use HTML. Really. Because even if you so s = RLE + s + PDF, the text will have right-to-left direction but not alignment.

3
  • Some users disable html on default so he needs a plain-text alternative for those users.
    – Gigala
    Mar 7, 2013 at 8:46
  • Please read again my comment. And understand: alignment is not something covered by Unicode, its part of the presentation layer.
    – elcuco
    Mar 7, 2013 at 8:55
  • 1
    that was not what i meant, the plain-text mail will most likely get aligned from left to right by the users mail client or whatever, however you need to do multipart emails including html and plain text
    – Gigala
    Mar 7, 2013 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.