First of all, you don’t need to know Farsi to help out here. I don’t understand Farsi myself, but the problem is obvious when you look at the page. Here’s a screenshot of the problem:
The problems are in the first and last rows. Reading from right to left (and the HTML header instructs the page to be read from right to left), you should see the country name, the header (in Farsia), the date and then in brackets, the source.
Here is the HTML header:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fa" lang="fa" dir="rtl">
As you can plainly see, the first line is screwed up because the closing bracket for the source (IASWI) goes after the final field, which is a link to a campaign and is highlighted in yellow.
The last line is even worse – it puts the source first, the country last. This should have nothing to do with the fact that the text is in English — because it’s tagged as being in Farsi (the link actually takes you to a page with both Farsi and English text).
Here is the PHP code for generating this line on our page:
echo (‘<a href=”http://www.labourstart.org/cgi-bin/show_news.pl?country=’);
echo $countryen;
echo (‘”><b>’);
echo $country;
echo (‘</b></a> ‘);
echo (‘<a href=”‘);
echo $url;
echo (‘” title=”‘);
echo $userid;
echo (‘”>’);
echo $header;
echo (‘</a> ‘);
if ($row2['actnowcampaigncode'] > 0) {
echo (‘ <a href=”http://www.labourstart.org/cgi-bin/solidarityforever/show_campaign.cgi?c=’);
echo $actnowcampaigncode;
echo (‘”><span style=”background-color:yellow;color:black”><b>Act</b><i>NOW!</i></span></a> ‘);
}
echo $dd;
echo (‘-’);
echo $mm;
echo (‘-’);
echo $yyyy;
echo (‘ [');
echo $source;
echo ('] ‘);
Anyone have any ideas about how to fix this? Thanks.

4 September 2008 at 12:22 am |
It seems to be a standart behavior http://www.i18nguy.com/markup/right-to-left.html
As I understand you have to use some other symbols than brackets or play with CSS and
4 September 2008 at 4:05 am |
Related problems to this cropped up with our Urdu page, although our problems were caused by CSS conflicts (I’m not sure if that is the problem here). Another issue I have seen is that if there is a LTR-character placed immediately next to a RTL-character (ie there is no space) then these kinds of can things happen. perhaps inserting a non-breaking space in the code might resolve this….?
4 September 2008 at 5:16 pm |
OpenConcept was actually involved in bringing the original Farsi collation into MySQL, so we have some experience with this. Unfortunately, that was some time ago. Great to see support for Persian with Labourstart.
One thing to consider is that your lines are actually bi-directional. You have left to right and right to left characters in the same space.
I think that it would be worth trying the direction to the specific elements of the page like:
body {
direction: rtl;
}
#description {
direction: ltr;
}
#title a {
direction: rtl;
}
That it would be more precise. Would require putting in more css into the page too. However the spacing option above is an easy thing to try.
Also, good to refer to:
http://www.w3.org/International/questions/qa-bidi-css-markup
5 September 2008 at 8:51 am |
Denis – that’s a really interesting page (http://www.i18nguy.com/markup/right-to-left.html) especially the comments about brackets. I may just try to remove the brackets and see what happens.
Jasper – I tried spacing issues, didn’t seem to help.
I’ll try the recommendation above and see if it fixes things.
5 September 2008 at 8:56 am |
Upate: Getting rid of the brackets in the Farsi edition solved one problem – but the last record (with the English title) is still behaving very oddly …
5 September 2008 at 3:18 pm |
It looks like you’ve got some mismatched tags (unclosed tags, etc)… but it’s hard to tell since your page has so many errors. Fixing these (some of them can be corrected by changing your doctype to something more lenient) and checking your pages regularly for validation will save you headaches in the future, especially with layout.
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.labourstart.org%2Ffa%2F
Also, you might want to consider writing a little less-verbose PHP. i stopped reading after the third line.
something like this would be more readable, and easier to check for bugs:
echo ’$country“;
echo “$header\r”;
5 September 2008 at 3:32 pm |
Hei! I’ve received some letters by you. I don’t like smaps but I liked this. I am from Iran and of course I know Farsi. Hpw can I help you?
5 September 2008 at 3:56 pm |
You could try using the print function instead of echo too. Sometimes I find it works better for some reason.
6 September 2008 at 12:15 am |
Hey there,
Poking around a bit with Firebug, it looks like the problem with the last line *is* related to the text being English.
If I replace the English text with Farsi text, the rtl alignment works as expected. I’m not sure exactly why this is the case, but it seems to me that for some reason the English text in the line in question is reversing the direction.
You can cause the same problematic result by replacing the English with Farsi text (which makes the alignment work) & then including inside the enclosing tag (which will again break the alignment).
No idea how to fix it, really. But I wouldn’t rule out the English text as the cause of your problem.
6 September 2008 at 12:17 am |
Oops. If I could edit my previous comment, I’d close the ‘a’ tag near the bottom. It looks like it’s gonna make everything below it turn into a link. Sorry!
6 September 2008 at 1:55 am |
Hi i am no expert but you might like to try the following
echo (’<a href=”http://www.labourstart.org/cgi-bin/show_news.pl?country=’);
…etc…
echo (‘] ‘);
hope this helps, if you want to remove as much style from the php/html then you can simply place
#line {
direction: rtl;
}
at the end of the CSS file
again hope this helps, cheers
6 September 2008 at 1:59 am |
sorry but my previous post was supposed to include a div to wrap the php, but the blog must not like actual div tags.
the div id was “line” and hence the CSS “#line”.