David Phillip Oster
unread,Nov 24, 2009, 5:11:23 PM11/24/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to iPhone SDK Development
OS X, iPhone and Macintosh have tremendous support for Unicode,
including Arabic. (also the tricky part: mixed Arabic, English, and
punctuation characters.) But, you have to use it correctly.
Store your text in an Arabic-safe encoding. I use UTF-8, which is the
standard for XML. ar.lproj/Localizable.strings are translated to
UTF-16 in the application bundle when you build your app.
NSLog(), because it is writing to the gdb console gets Arabic wrong
becuase gdb is a GNU product, not an Apple product. If you log to a
file, or use NSURLConnection to HTTP POST to a web site you control,
and you specify in your web page that the charset is UTF-8, with a
header on your web page like:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
then you'll be able to see the Arabic correctly. On the iPhone, OS X
version 3.0 and later has support for the Unicode range of Arabic:
\u0600 through \u06FF.
Macintosh adds support for the explicit ligature characters up in FB50
through FDFF and FE70 through FEFF, but those characters are NOT
supported on iPhone.
on iPhone, UITextView, UIWebView and the ordinary text drawing methods
in UIStringDrawing.h will draw Arabic correctly to the screen.
In the simulator, you can use NSString's writeToFile:atomically:
In the debugger, you can even say:
p (BOOL)[myString writeToFile:@"/Users/Shared/temp.txt"
atomically:NO]; and gdb will tell your app to write the string to a
file where you can look at it in Xcode. (Be smart, and set your
default text file format in Xcode and TextEdit to UTF-8.)