NSStrings to CStrings and hex encoding...
NSStrings to CStrings and hex encoding...
- Subject: NSStrings to CStrings and hex encoding...
- From: Andrew Satori <email@hidden>
- Date: Tue, 24 Jun 2014 22:15:11 -0400
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