I am a fresher with Object-C and I would like to make an application that it can convert between romaji, kanji, katakana, hiragana. I had searched and found out sample source code that it meet with my demand at https://github.com/00StevenG/NSString-Japanese link.
I has downloaded source code from this link and run it in Xcode. The application has run normally but functions convert between romaji, hiragana, katakana and kanji are not working. When I executed debug, I has recognized that the source code as below always return only value is kCFStringTokenizerTokenNone.
// create a tokenizer to enumerate by WORD
CFStringTokenizerRef tok = CFStringTokenizerCreate(NULL,
(CFStringRef)self,
CFRangeMake(0,self.length),
kCFStringTokenizerUnitWord,
CFLocaleCreate(kCFAllocatorDefault, CFSTR("Japanese")));
// goto the first token in the string
CFStringTokenizerTokenType result =CFStringTokenizerAdvanceToNextToken(tok);
So that code below is never executed and can not convert romaji, hiragana, katakana, kanji.
while(result !=kCFStringTokenizerTokenNone){
...
}
Below is the text that I used as parameter to pass into your app
"映画作品"
Could you please point out or give me any hints to cope with this problem.
Dear Mr Steven Grace
I am a fresher with Object-C and I would like to make an application that it can convert between romaji, kanji, katakana, hiragana. I had searched and found out sample source code that it meet with my demand at https://github.com/00StevenG/NSString-Japanese link. I has downloaded source code from this link and run it in Xcode. The application has run normally but functions convert between romaji, hiragana, katakana and kanji are not working. When I executed debug, I has recognized that the source code as below always return only value is kCFStringTokenizerTokenNone. // create a tokenizer to enumerate by WORD CFStringTokenizerRef tok = CFStringTokenizerCreate(NULL, (CFStringRef)self, CFRangeMake(0,self.length), kCFStringTokenizerUnitWord, CFLocaleCreate(kCFAllocatorDefault, CFSTR("Japanese"))); // goto the first token in the string CFStringTokenizerTokenType result =CFStringTokenizerAdvanceToNextToken(tok); So that code below is never executed and can not convert romaji, hiragana, katakana, kanji. while(result !=kCFStringTokenizerTokenNone){ ... } Below is the text that I used as parameter to pass into your app "映画作品" Could you please point out or give me any hints to cope with this problem.
Best regards, Vuong Nguyen