I am writing one application for iPhone. It reads data from "sqlite" database, puts data in NSMutableArray
and displays the data in UITableView
("indexPath" correspond to the id
column in the database). One column in the database is turkish_words
and it contains Turkish words with Turkish characters like İöşüçğı
. I'm reading data from the database using "FMDB framework".
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsPath = [paths objectAtIndex:0];
NSString *dbPath = [docsPath stringByAppendingPathComponent:dbFileName];
FMDatabase *database = [FMDatabase databaseWithPath:dbPath];
[database open];
NSString *sqlSelectQuery = @"SELECT id,turkish_word FROM words";
Then I'm adding data to the NSMutableArray
like this:
FMResultSet *resultsWithNameLocation = [database executeQuery:sqlSelectQuery];
while([results next]) {
NSString *strID = [NSString stringWithFormat:@"%d",[results intForColumn:dbIDKey]];
NSString *strTur = [NSString stringWithFormat:@"%@",[results stringForColumn:dbTurkishKey]];
[self.words insertObject:[strTur lowercaseString] atIndex:[strID integerValue]];
}
All this code is in the AppDelegate.m
UITableView
is then populated with data from appDelegate.words
in other UITableViewController
.
The problem is next. Cells with Turkish characters are looking like This:
Now lets say that I want details for the word. New UIView
is going to be pushed when I click to the cell containing word. Word is passed to "DetailViewController" in
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
Everything is working and I'm getting the word I clicked in "DetailViewController". Now I'm trying to create SELECT
statement based on the word I got from previous UITableViewController
. When I NSLog
it, it's look good, for example:
SELECT id,turkish_word,detail FROM words WHERE turkish_word="fi̇ldi̇şi̇ sahi̇li̇"
It looks good, but get 0 rows for the result. When I run the query using "sqlite bash", it also returns 0 rows, but when I type it, I get row which I want. Bear in mind that copied one and typed one are looking the same, copied one is copied from NSLog
and it returns 0 rows, and the typed one returns result I want.
I really don't know what to do about this.