objective c - dots, commas etc get converted into a special symbol "?" in iphone -


i'm using database fetch datas. there 750 questions in database.some questions contain special character's ",....,' etc. while fetch data , print in textview converted "?". there way remove these kind of symbols , print in original format.

enter image description here

i used below code fetching , displaying in textview.

    qsql=[nsstring stringwithformat:@"select * mydata col_1 = '365'"];      if(sqlite3_prepare_v2(database, [qsql utf8string], -1, &statement, null) == sqlite_ok) {         while (sqlite3_step(statement) == (sqlite_row))     {           char *field0 = (char *)sqlite3_column_text(statement, 1);         char *field1 = (char *)sqlite3_column_text(statement, 2);         nsstring *t1 = nil;         if(field0!=null){           t1 = [[nsstring alloc] initwithutf8string:field0];             //nsstring *t1 = [[nsstring alloc] initwithcstring:field0 encoding:nsutf8stringencoding];             nslog(@"%@jujuj" ,t1);         }         nsstring *t2 = nil;         if(field1!=null){             t2 = [[nsstring alloc] initwithutf8string:field1];              nslog(@"%@jhjhh" ,t2);         }           nsstring *string=t1;         nscharacterset *donotwant = [nscharacterset charactersetwithcharactersinstring:@",."];       string = [[string componentsseparatedbycharactersinset:donotwant] componentsjoinedbystring:@""];         nslog(@"%@jhgkjghkjg",string);         //nslog(@"%@ %@",q_no, q_no1);         tv.text=t1;         tv1.text=t2;            [t1 release];         [t2 release];     }   } 

use nscharacterset remove special character string

nsstring *string = @"ram,...";     nscharacterset *donotwant = [nscharacterset charactersetwithcharactersinstring:@",."];     string = [[string componentsseparatedbycharactersinset:donotwant] componentsjoinedbystring:@""];     nslog(@"%@",string); 

Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -