tags:

views:

191

answers:

3

I have a aspx page who's title has both Hebrew and English characters in it, and the order of the words gets messed up.
Is there a way to style the title so the words don't get messed up, or is it an OS problem?

This is what the title should say: good This is what the title actually looks like: not good

A: 

if you use utf-8 you shouldn't have a problem.

add the following to your <head> and make sure you are saving as utf-8

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Josh
We have this tag in the <head>. As to saving as utf-8 - it's an aspx page, I don't know of any place to tell it to be saved as such.
Lea Cohen
try adding this to your web.config <globalization requestEncoding="utf-8" responseEncoding="utf-8"fileEncoding="utf-8" />
Josh
Josh: The order of the words has nothing to do with the encoding. You can safely assume that the characters itself are getting transferred correctly. Looking at the screenshot in the question now you can see it's definitely *not* an encoding issue.
Joey
@Josh The problem is that the title is rendered as an LTR paragraph.
jleedev
to be fair there wasn't a screenshot when i answered the question
Josh
+3  A: 

Try using the Unicode direction embedding codes:

The result looks like ‫הוספת קובץ JS עורך ישן‬ - Mozilla Firefox, and it's marked up as follows:

&#x202B; (right-to-left embedding)
הוספת קובץ
JS
עורך ישן
&#x202C; (pop directional formatting)
- Mozilla Firefox

(You ought to be able to write the title with <title dir="rtl">, but I couldn't get that to work.)

jleedev
I think the `dir=rtl` is the way to go but it could be that it has to be specified in the `body` or `html` tags already. I don't know for sure.
Pekka
I think `dir=rtl` only has an effect on the HTML rendering, not on widgets outside the browser.
jleedev
+3  A: 

@jleedev already has what seems to be the right answer. Here is a bit of background information on it:

Creating HTML Pages in Arabic, Hebrew and Other Right-to-left Scripts

There are some situations where you may not be able to use the markup described in the previous section. In HTML these include the title element and any attribute value.

In these situations you can use invisible Unicode characters that produce the same results.

To replicate the effect of the markup described in the example above related to nested base directions, we can use pairs of characters to surround the embedded text. The first character is one of U+202B RIGHT-TO-LEFT EMBEDDING (RLE) or U+202A LEFT-TO-RIGHT EMBEDDING (LRE). This corresponds to the markup <span dir="rtl"> or <span dir="ltr">, respectively. The second character is U+202C POP DIRECTIONAL FORMATTING (PDF). This corresponds to the in the markup. Below you can see how to apply this to the previous example.

<p>The title says "&#x202B;...&#x202C;" in Hebrew<p>
Pekka
Nice link. I still say it's counterintuitive that the `dir` attribute is supposed to behave as if it surrounded the text with the invisible override characters, but that doesn't work around the `title` element.
jleedev