Japanese Language

2009-07-15 Thread Development
Ok, I lucked out and got a great chance at releasing a bit of software  
in japan. The problem is that it is 50/50 client to web. My primary  
concerns are string translation from iPhoneOS to data being stored in  
a mysql database. I have spent quite a bit of time googling and am  
still not sure but is the japanese data that will be sent from my  
application to my server utf-8? Or is it utf-16 as I for some reason  
thought. Everything sent to the server is pre encoded for transport,  
stored and then unencoded by the app so I feel at least a level of  
confidence that if I encode with the correct string encoding my server  
side will just accept and store the data. I dunno. Maybe I'm  
completely confused.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Japanese Language

2009-07-15 Thread Ricky Sharp


On Jul 15, 2009, at 5:36 PM, Development wrote:

Ok, I lucked out and got a great chance at releasing a bit of  
software in japan. The problem is that it is 50/50 client to web. My  
primary concerns are string translation from iPhoneOS to data being  
stored in a mysql database. I have spent quite a bit of time  
googling and am still not sure but is the japanese data that will be  
sent from my application to my server utf-8? Or is it utf-16 as I  
for some reason thought. Everything sent to the server is pre  
encoded for transport, stored and then unencoded by the app so I  
feel at least a level of confidence that if I encode with the  
correct string encoding my server side will just accept and store  
the data. I dunno. Maybe I'm completely confused.



You'll want to first understand the encoding of your endpoints and  
then pick an appropriate transport encoding.


In terms of MySQL, you can define the encoding of a column to be  
something like this:


varchar(100) character set UTF8

Or, pick whatever encoding you deem appropriate (perhaps UTF-16?)

On the iPhone, all textual data in memory (e.g. NSString) will be  
UTF-16.  If you store data in files on the iPhone, you'll want to  
store them in some well-known encoding.  This will typically be UTF-16  
especially if you simply archive NSString objects.


As for the transport, I would highly recommend UTF-8 as no  
byteswapping is needed.  For most Latin-based data, the number of  
bytes taken up in UTF-8 will be less than what is used by UTF-16.  For  
Japanese (and many other languages), the number of bytes of UTF-8 will  
be more than UTF-16.  Just wanted to point that out in case you have  
insanely strict bandwidth requirements.


Then, it's just a matter of calling the correct APIs at each endpoint  
to ensure you don't mangle the text.



___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Japanese Language

2009-07-15 Thread Greg Guerin

Ricky Sharp wrote:

As for the transport, I would highly recommend UTF-8 as no  
byteswapping is needed. For most Latin-based data, the number of  
bytes taken up in UTF-8 will be less than what is used by UTF-16.  
For Japanese (and many other languages), the number of bytes of  
UTF-8 will be more than UTF-16. Just wanted to point that out in  
case you have insanely strict bandwidth requirements.


Depending on what the server and client are using as the transport  
protocol, it may support a compressed encoding.  For example, HTTP  
1.1 has a gzip option for content encoding (also compress and  
deflate, but in my experience gzip is more often seen).  See sec. 3.5  
Content Codings of RCC2616.


http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html

In general, a client states its supported encodings and the server  
chooses, or the two participants negotiate.  Again, this depends on  
what the transport protocol is: not all of them support compression.


  -- GG

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com