• 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: NSStrings to CStrings and hex encoding...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSStrings to CStrings and hex encoding...


  • Subject: Re: NSStrings to CStrings and hex encoding...
  • From: "Stephen J. Butler" <email@hidden>
  • Date: Tue, 24 Jun 2014 21:29:01 -0500

Those are the UTF-8 sequences for smart quotes. It's not coming from
cStringUsingEncoding, but directly from NSTextView:

http://stackoverflow.com/questions/19801601/nstextview-with-smart-quotes-disabled-still-replaces-quotes

Rant: This has been a super annoying Mavericks feature IMHO. Even when you
put TextEdit into plain text mode it still does the smart quotes.


On Tue, Jun 24, 2014 at 9:15 PM, Andrew Satori <email@hidden> wrote:

> Alright, I am stumped so I am asking for help (and it is annoying me
> because I am 100% certain that the answer will be stupid simple).
>
> I have a bit of code (old code I might add) that I am updating to ARC and
> other such modern features.  Unfortunately, I have run into a little snag.
>  The code calls out to a C library that expects good old fahsioned C
> Strings of the UCHAR * variety. In prior versions of OS X and Cocoa
> cStringUsingEncoding would return the string and things would be ducky.
>  However, starting with Mavericks and Xcode 5 I am seeing a problem where
> the resulting char * is encoding characters to hex representations.  So for
> example, the following NSString taken from an NSTextView content
>
> NSString myValue = "select * from some_table where column_name = 'value'"
>
> becomes
>
> (UCHAR *)szValue = "select * from some_table where column_name =
> \xe2\x80\x98value\xe2\x80\x99"
>
> Even more disturbing is that it only happens when typed into the
> NSTextView.  Pasting the above NSString value into the NSTextView results
> in the unescaped output. I am guessing that is has to do with the settings
> on the  NSTextView, but I do not see what changed to cause this.  I am
> hoping someone can clue me into the probably dead obvious problem.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
>
> This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


  • Follow-Ups:
    • Re: NSStrings to CStrings and hex encoding...
      • From: Andrew Satori <email@hidden>
References: 
 >NSStrings to CStrings and hex encoding... (From: Andrew Satori <email@hidden>)

  • Prev by Date: NSStrings to CStrings and hex encoding...
  • Next by Date: Re: NSStrings to CStrings and hex encoding...
  • Previous by thread: NSStrings to CStrings and hex encoding...
  • Next by thread: Re: NSStrings to CStrings and hex encoding...
  • Index(es):
    • Date
    • Thread