Search code examples
objective-cios6uikeyboardxcode4.6

Convert punjabi text to English text


In my app I need to use punjabi language and English Language.So I customized the keyboard to show punjabi alphabets. I need to use these punjabi words for implementing a search, but the database will not support punjabi language.The punjabi data is stored in the database in English format. So I need to convert the punjabi text again to English before starting the search. I tried the following code to get back the word in English form.

[txtSearch setFont:[UIFont systemFontOfSize:20]];

But again I am getting punjabi text. Is there any way to convert back these words ?

Searching screen in my app


Solution

  • NSMutableString *buffer = [@"русский язык" mutableCopy];
    CFMutableStringRef bufferRef = (__bridge CFMutableStringRef)buffer;
    CFStringTransform(bufferRef, NULL, kCFStringTransformToLatin, false);
    NSLog(@"%@", buffer);