On 16 November 2012 10:38, Simon Owen <[email protected]> wrote:
> For the other ports I was planning to use iconv to do the main
> transliteration step. Under Linux iconv (part of libc-bin) appears to
> include the support I'm after. Mac OS X is still using the traditional
> libiconv, which gives strange results with the accents separated out
> ("coupé" -> "coup'e"). If I can't find a quick and easy solution for
> that I'll just drop transliteration support. I'd rather spend my
> SimCoupe development time on emulation, not text conversion!
What's your policy on native code? I ran a quick test with:
NSString *testString = @"Coupé";
char terminator = '\0';
NSMutableData *asciiData = [[[testString
dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]
mutableCopy] autorelease];
[asciiData appendBytes:&terminator length:1];
NSLog(@"%@ %s", testString, [asciiData bytes]);
Output was: Coupé Coupe
cStringUsingEncoding: directly on the string didn't do the job sadly
since it doesn't permit a lossy conversion and there's no direct
method for a lossy conversion with a C-style terminator.