On Jun 15, 2011, at 12:34 PM, Bing Li wrote:

> Yes, TCP has the boundary issue. So I put a "\n" at the end of each XML. And 
> there is no "\n" within any XML.

That has nothing to do with the issue of UTF-8 sequences being split across 
reads.

In UTF-8, non-ASCII characters are represented as multi-byte sequences (where 
each byte has the high bit set.) If the message is broken into packets such 
that one packet ends partway through such a sequence and the next packet begins 
with the rest of it, then neither packet’s contents will be parseable by itself 
as UTF-8 and the NSStrings you get will be nil. So you’ll lose data.

> However, it should not be the reason to cause memory leaks, right?

No, but it sounds like your code has bigger problems than memory leaks, so you 
probably shouldn’t worry about those yet. (And I believe we’ve already told you 
what you need to know about tracking down the leaks.)

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

Reply via email to