4

In farsi letters are attach together to form writing scripts. However when I save HTML pages using "UTF-8" or "Windows-1256" encdoings, and try to display them using webview in android, letters are diplayed seperately and in left-to-right direction (instead of RTL). I should notice that this case is not happening in phones supporting farsi.

Correct form should be like this (snapshot from phone supporting farsi):
Sample of right form
Bad-formed text happens in phones not supporing farsi (Persian):

Sample of bad-formed display

It should be noticed i've used persian font in both cases. I also see some solutions for normal Strings in java which changes character on by one in this question

My question: Can i fix this cases (or it should be fix by phone vendors)? if possible what is solution?

Community
  • 1
  • 1
VSB
  • 9,825
  • 16
  • 72
  • 145

2 Answers2

1

I hit this bug a lot when I was doing keyboards. The problem is that the build in canvas.drawText function in Android didn't support RTL languages. There was a patch for it, but it wasn't part of the default build of Android. So only models going out to those parts of the world that used it tended to have it. Unfortunately I know of no way to test whether it has the patch. And if it doesn't, there's no way to fix it. You could try reversing the text, but then you'd break devices which did have the patch.

Long story short- there is no way to fix it. However, I'd be shocked if Google hasn't picked up the patch in mainline by now (it existed back in the 2.2 days), so its a shrinking number of phones effected.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • Thanks :) As i tested on 2.2 and 3.1 original Google android releases using emulator it seems that problem fixed on 3.1. however does this bug on 2.2 is noticed somewhere by Google, officially? – VSB Apr 06 '13 at 21:28
  • dear gabe can you answer this? – VSB Dec 03 '13 at 13:22
  • I don't know if they ever talked about it, it was just something known in the keyboard community. You could only do RTL on units with the patch. They fixed it in 3.x, and they aren't maintaining the old OSes, so there's no good answer other than target 3.0+. Remember any unit shipped to those areas of the world will have a fix. – Gabe Sechan Dec 04 '13 at 00:53
  • thanks for your notice. the fix is applied to many phones however some phone vendors did not care about this carefully and did not care about localization very well. by the way thanks :) – VSB Dec 08 '13 at 11:35
0

You can try making html with reverse font sequence! just write a windows app to get font and deliver reverse one, and use it in your android device

farhad.kargaran
  • 2,233
  • 1
  • 24
  • 30