views:

229

answers:

3

Hi

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  A: 

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).

Osama ALASSIRY
+1 people are not using unicode control characters enough
elcuco
A: 

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.

elcuco
A: 

Right-to-left is something Microsoft and others imagine the world might need but it doesn't. The prominent software for writing these languages progresses through characters in that order, it doesn't store it LTR then transform it to RTL. Eg, typing a, b, c (underscore is the cursor):

   _
  _a
 _ba
_cba

NOT

_
a_
ab_
abc_
[now use a stylesheet to reverse it]
Dinah