Reputation: 4029
With Python 2.7.11, I am trying to build a string with Arabic characters and a number. But, the number always ends up on the left side of the final string instead of the right. Here is my code:
#! /usr/local/bin/python -*- coding: UTF-8 -*-
city = 'الدوحة'
street = 'شارع بابل'
number = '6990'
address = city + ' ' + street + ' ' + number
print address
address = number + ' ' + city + ' ' + street + ' '
print address
And the output, from Aptana:
الدوحة شارع بابل 6990
6990 الدوحة شارع بابل
What can I do to force the number to the right of the final string?
UPDATE Turns out, from the command line, the output is as expected, but, from Apatana Studio, the console is reformatting the string. Arabic is tricky to work with using English tools.
That said, I think the string is correct. But, I am next inserting into MySQL and then displaying on a web page, where it is wrong. So, not sure if the insert is re-formatting it, or, if it is being rendered incorrectly by HTML.
Upvotes: 1
Views: 740
Reputation: 39023
The problem is with Aptana, it doesn't know anything about right-to-left and displays everything left-to-right, as you have seen.
On the web page, set the page's direction to right-to-left, or at least the element where you display the Arabic strings.
Upvotes: 1