I looked hours to solve this issue, and found nothing. Sorry if answer is somewhere on Internet, I really couldn’t find it.
I have a NSString *header = @"ästrç"; or with any other umlauts from German, Swedish, etc languages.
I need this NSString converted to:
const char* cString = [header cStringUsingEncoding: NSASCIIStringEncoding];
Note: NSASCIIStringEncoding, NSMacOSRomanStringEncoding not working.
I also tried this:
const char *cString = [header UTF8String];
Not working.
Can someone help me please? This is very strange.
EDIT:
By “not working” I mean that if I have these chars:

It will output this:

I don’t care of NSLog. I need that const char * for a method to write in PDF:
HPDF_Page_TextOut (HPDF_Page page, HPDF_REAL xpos, HPDF_REAL ypos, const char *text)
const char *cString = [header UTF8String]will work, but you are probably testing it withNSLog("%s, cString);.NSLog will not work, because
%sis expecting ASCII string not UTF-8.Details: convert NSString to const char *.