android - downloaded non-english html file not readable in webview -


save (malayalam) string content code

    string = "<html><head><style>"             + "@font-face { font-family: manorama;src: url(file:///android_asset/manorama.ttf); }"             + "h1 { color: #222;font-size: 26px;margin-top: 32px; }"             + "</style></head><body><h1>"             + "<font face=\"manorama\">Øíxàw ¥çÄÞùßxßÏßw 190 æd¿ÏßÈß</font><!--3546062932-->"             + "</p><body></html>";      fileoutputstream ostream = null;     try {         ostream = openfileoutput("0.html", context.mode_private);         ostream.write(a.getbytes("utf-32"));         ostream.close();     } catch (exception e) {     } 

it working perfectly

but when same operation after downloading server doesn't work (characters non readable in webview),

find code below,

        httpclient client = new defaulthttpclient();         httpresponse response = null;         inputstream in = null;         try {             response = client.execute(new httpget(                     "http://tinymail.in/mail_pipe/thozhilveedhi/pull"));             in = response.getentity().getcontent();         } catch (exception e) {         }         bufferedreader reader = new bufferedreader(                 new inputstreamreader(in));         stringbuilder string = new stringbuilder();         string line = null;         try {             while ((line = reader.readline()) != null) {                 string.append(line);             }             in.close();         } catch (exception e) {         }          string[] = (string.tostring()).split("__");          (int = 0; < a.length; i++) {             if (a[i] != "") {                  try {                     fileoutputstream ostream = openfileoutput(i + ".html",                             context.mode_private);                     ostream.write(a[i].getbytes("utf-32"));                     ostream.close();                 } catch (exception e) {                 }              }         } 

i think problem @ data transfer server android, can ??
base 64 transfer encoding solve problem ??
please help

        httpclient client = new defaulthttpclient();         httpresponse response = null;          try {             response = client.execute(new httpget(                     "http://tinymail.in/mail_pipe/thozhilveedhi/pull"));         } catch (exception e) {         }          httpentity entity = response.getentity();         if (entity != null) {              string data = entityutils.tostring(entity);             string[] = null; 

..
to read file & code below save

                    try {                         fileoutputstream ostream = openfileoutput(i                                 + ".html", context.mode_private);                         ostream.write(a[i].getbytes("utf-16"));                         ostream.close();                     } catch (exception e) {                     }                  }             }          } 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -