• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [Q] Garbage strings appened to a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Q] Garbage strings appened to a string


  • Subject: Re: [Q] Garbage strings appened to a string
  • From: Nick Zitzmann <email@hidden>
  • Date: Mon, 26 Sep 2005 22:35:36 -0600


On Sep 26, 2005, at 10:20 PM, JongAm Park wrote:

Whenever the OK button is pressed, some garbages are appended to the "Hello, Jane". Sometimes it is OK, though.
Can anyone tell me why this inconsistent result is obtained?

You were probably looking at the UTF-16 BOM, which is 0xFEFF. If you turn an NSString into Unicode data using any method other than (IIRC) -getCharacters:, then NSString will always put the UTF-16 BOM in front of the data.


In any case, if you want to insert a string into another string using -stringWithFormat:, then use %@ instead of %S as the placeholder.

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >[Q] Garbage strings appened to a string (From: JongAm Park <email@hidden>)

  • Prev by Date: [Q] Garbage strings appened to a string
  • Next by Date: Re: substringWithRange: memory leak problem
  • Previous by thread: [Q] Garbage strings appened to a string
  • Next by thread: Re: [Q] Garbage strings appened to a string
  • Index(es):
    • Date
    • Thread