Skip to content

Instantly share code, notes, and snippets.

@chengfred
Created May 18, 2011 18:35
Show Gist options
  • Save chengfred/979204 to your computer and use it in GitHub Desktop.
Save chengfred/979204 to your computer and use it in GitHub Desktop.
Simplenote iOS note encoding
NSString *notestring = [[currentNote noteDictionaryWithContent: YES] JSONRepresentation];
// notestring now contains a JSON string with note data
NSString *encodedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(
NULL,
(CFStringRef)notestring,
NULL,
(CFStringRef)@"!*'();:@&=+$,/?%#[]",
kCFStringEncodingUTF8 );
NSData *data = [encodedString dataUsingEncoding:NSUTF8StringEncoding];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment