Search code examples
objective-chebrewpunctuation

Hebrew punctuation displayed incorrectly in Objective-C


I have the very basic line:

self.label.text = @",הם הכריחו אותה לשתות ויסקי";

Notice the comma at the left of the string. When this displays in a UILabel, I see the comma at the right. This is one example of punctuation problems I am seeing with Hebrew.

Any ideas for resolving this?


Solution

  • I've been reading up on Bi-directional text, it seems as though certain Unicode characters specify certain properties of the following text. Through experimentation, I've found that the Right-To-Left Isolate character, or U+2067 ⁧, will cause the text that follows to be displayed in the correct order. So the Objective C solution to the problem was:

    self.label.text = [@"\u2067" stringByAppendingString: @",הם הכריחו אותה לשתות ויסקי"];