Re: NSStrings to CStrings and hex encoding...
Re: NSStrings to CStrings and hex encoding...
- Subject: Re: NSStrings to CStrings and hex encoding...
- From: Andrew Satori <email@hidden>
- Date: Tue, 24 Jun 2014 22:40:11 -0400
And we have a winner. Thanks. I had unchecked it in XCode, so didn't think that was the culprit, but your code change made things all better.
Thanks, I knew it was something obvious and simple.
On Jun 24, 2014, at 10:29 PM, Stephen J. Butler <email@hidden> wrote:
> 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