android - JSON with french character in raw folder -
i have json file in raw folder name of school.json. want parse json using following code , put in listview gives me unknown character in list because of french character in json file. how fix french character.
{ "records" : { "record" : [ { "row" : { "a" : "collège", "b" : "8/22/2013", "c" : "8/23/2013" } }, { "row" : { "a" : "collège", "b" : "8/23/2013" } }, { "row" : { "a" : "d'anjou", "b" : "8/23/2013" } }, { "row" : { "a" : "collège", "b" : "8/26/2013" } }, { "row" : { "a" : "collège", "b" : "8/26/2013" } }, { "row" : { "a" : "collège", "b" : "8/26/2013" } }, { "row" : { "a" : "school", "b" : "9/20/2013" } } ] } }
//-----------------my method
public string getjson() { inputstream = getresources().openrawresource(r.raw.school); writer writer = new stringwriter(); char[] buffer = new char[1024]; try { reader reader; try { reader = new bufferedreader(new inputstreamreader(is, "utf-8")); int n; while ((n = reader.read(buffer)) != -1) { writer.write(buffer, 0, n); } } catch (unsupportedencodingexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } { try { is.close(); } catch (ioexception e) { // todo auto-generated catch block e.printstacktrace(); } } return writer.tostring(); }
Comments
Post a Comment