How to correctly transliterate Cyrillic, without diacritics, using CFStringTransform?

I am trying to use CFStringTransform to transliterate names entered in Russian to a safe ASCII for credit card processing. However, when stripping diacritics č becomes a c, which is really not a good transliteration. Is there anyway I can use CFStringTransform, without diacritics? In other words, ч, should return ch, as it's supposed to in almost every standard

NSMutableString *name = [@"романчук" mutableCopy];
CFMutableStringRef nameRef = (__bridge CFMutableStringRef)name;
CFStringTransform(nameRef, NULL, kCFStringTransformToLatin, false); //name is romančuk
CFStringTransform(nameRef, NULL, kCFStringTransformStripCombiningMarks, false); //name is now romancuk


Create category to NSString and add these methods:

- (NSString *)toLatinWithDictionary
    NSMutableString *newString = [NSMutableString string];
    NSRange range;
    NSString *symbol;
    NSString *newSymbol;

    for (NSUInteger i = 0; i < [self length]; i ++)
         //  Take regular symbol
        range = NSMakeRange(i, 1);
        symbol = [self substringWithRange:range];
        newSymbol = [self transliterateChar:symbol];
        if (newSymbol != nil)
            [newString appendString:newSymbol];
            [newString appendString:symbol];
    return [NSString stringWithString:newString];

- (NSString *)transliterateChar:(NSString *)symbol
    //  For simlicity there is only
    NSArray *cyrillicChars = @[@"а", @"б", @"в", @"г", @"д", @"е", @"ё", @"ж", @"з", @"и", @"й", @"к", @"л", @"м", @"н", @"о", @"п", @"р", @"с", @"т", @"у", @"ф", @"х", @"ц", @"ч", @"ш", @"щ", @"ъ", @"ы", @"ь", @"э", @"ю", @"я"];
    NSArray *latinChars = @[@"a", @"b", @"v", @"g", @"d", @"e", @"yo", @"zh", @"z", @"i", @"y", @"k", @"l", @"m", @"n", @"o", @"p", @"r", @"s", @"t", @"u", @"f", @"h", @"ts", @"ch", @"sh", @"shch", @"'", @"y", @"'", @"e", @"yu", @"ya"];
    NSDictionary *convertDict = [NSDictionary dictionaryWithObjects:latinChars
    return [convertDict valueForKey:[symbol lowercaseString]];

Need Your Help

Referencing a specific repeater item instance

c# web-applications repeater datamember

I've been looking all over StackOverflow and Google for an answer to this question, but I haven't been able to find anything.

Collision of Sprites in CCSpriteBatchNode and CCParallaxNode

iphone xcode cocos2d-iphone

I have two sprites one is added as the child of CCSpriteBatchNode and the other as the child of CCParallaxNode. Is there any method to detect their collision? I have used the following code.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.