I have a problem I hope someone can help with. My MIDlet lets the user enter some text and then I display it in a Canvas using drawString. I use a basic word wrap algorithm to handle longer, multi-line text, nothing fancy. Everything is fine except if the user enters text in languages that are written right-to-left. Say the user enters some Hebrew or Arabic, I want to know this and thus right-align the text when drawn.
My question is, how can I detect whether the user's input is a right-to-left or a left-to-right language? I just want to know which text to left-align and which to right-align, since the user can enter any string into the input. Any suggestions?

Reply With Quote


