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 protected]> 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 protected])
>
> 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:
>
> https://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com
>
> This email sent to [email protected]
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to