andbook!.pdf - Learning Android Get an anddev.org - Android-Shirt Back to index
anddev.org Header Logo
FAQ Search Top rated articles Browse Feeds anddev.org - Authors Contact Details Register Log in

Getting Data From the Web (URLConnection via http)

Goto page 1, 2  Next
 
       anddev.org - Android Development Community | Android Tutorials | Index -> Novice Tutorials
Author Message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Sat Dec 22, 2007 4:37 pm    Post subject: Getting Data From the Web (URLConnection via http) Reply with quote

Getting Data From the Web (URLConnection via http)


What you will learn: You will learn how to download files/data from any URL (useful for reading the returned xml-data from Web2.0-APIs)

Question Problems/Questions: Write it right below...

Difficulty: 1.5 of 5 Smile

What it will look like:


Description:
0.) We will use just URL, URLConnection and InputStreams to receive data from a txt-file via http from the web. (works with any other dynamic url, too Exclamation like the Google Weather API http://www.google.com/ig/api?weather=Schriesheim,Germany )

This is the full Code:
Java:
package org.anddev.android.getdatafromtheweb;

import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;

import org.apache.http.util.ByteArrayBuffer;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class GetDataFromTheWeb extends Activity {
     @Override
     public void onCreate(Bundle icicle) {
          super.onCreate(icicle);

          /* We will show the data we read in a TextView. */
          TextView tv = new TextView(this);
          
          /* Will be filled and displayed later. */
          String myString = null;
          try {
               /* Define the URL we want to load data from. */
               URL myURL = new URL(
                         "http://www.anddev.org/images/tut/basic/getdatafromtheweb/loadme.txt");
               /* Open a connection to that URL. */
               URLConnection ucon = myURL.openConnection();

               /* Define InputStreams to read
                * from the URLConnection. */

               InputStream is = ucon.getInputStream();
               BufferedInputStream bis = new BufferedInputStream(is);
               
               /* Read bytes to the Buffer until
                * there is nothing more to read(-1). */

               ByteArrayBuffer baf = new ByteArrayBuffer(50);
               int current = 0;
               while((current = bis.read()) != -1){
                    baf.append((byte)current);
               }

               /* Convert the Bytes read to a String. */
               myString = new String(baf.toByteArray());
          } catch (Exception e) {
               /* On any Error we want to display it. */
               myString = e.getMessage();
          }
          /* Show the String on the GUI. */
          tv.setText(myString);
          this.setContentView(tv);
     }
}

Thats it Smile

Regards,
plusminus

_________________

| Android Development Community / Tutorials


Last edited by plusminus on Sun Feb 03, 2008 7:03 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
venkat
Senior Developer


Joined: 27 Nov 2007
Posts: 152
Location: India

PostPosted: Sat Dec 22, 2007 4:58 pm    Post subject: Reply with quote

Dear PlusMinus, Thank u for Great Tutorial. Smile

Can you tell me how to set proxy and authentication using code. because i am behind the proxy and it will ask authentication. i have attached screen shot of my error.

Thanks and regards,
venkat.



device.png
 Description:
 Filesize:  5.92 KB
 Viewed:  6350 Time(s)

device.png


Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Sat Dec 22, 2007 5:01 pm    Post subject: Reply with quote

Hello venkat,

perhaps sth like this works:
Java:
               // ...
               /* Open a connection to that URL. */
               URLConnection ucon = myURL.openConnection(new Proxy(...));
               // ...


Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
venkat
Senior Developer


Joined: 27 Nov 2007
Posts: 152
Location: India

PostPosted: Sat Dec 22, 2007 5:20 pm    Post subject: Reply with quote

yes plusminus, i tried this. but still it not working. i have attached my full source code here..


Java:
public class GetDataFromTheWeb extends Activity
{
     String myString = "Test: ";
   Proxy p;
    @Override
    public void onCreate(Bundle icicle)
    {
     try{ 
          
          Socket s=new Socket("vsnlproxy.in",3128);
     SocketAddress sa=s.getLocalSocketAddress();
          p=new Proxy(Proxy.Type.HTTP,sa);
     }catch(Exception e)
     {
          myString = "Socket Error"+e;
     }
     super.onCreate(icicle);
        TextView tv = new TextView(this);
        try
        {
          URL myURL = new URL("http://www.anddev.org/images/tut/basic/getdatafromtheweb/loadme.txt");

          URLConnection ucon = myURL.openConnection();
         
          InputStream is = ucon.getInputStream();
          InputStream bis = new BufferedInputStream(is);
          Reader reader = new InputStreamReader(bis);
         
          int x;
          int count = 0;  
          byte by[] = new byte[20];
          while((x = reader.read()) != -1)
          {
               if(count < 20)
               {
                    by[count] = (byte) x;
               }
               count++;
          }
          for(int i=0; i<20; i++)
          {
               myString = myString + (char)by[i];
          }
        }
        catch(MalformedURLException ex)
        {
          myString = "MalformedURLException occured.";
        }
        catch(IOException ex)
        {
          myString = "IOException occured." + ex;
        }
       
        tv.setText(myString);
        setContentView(tv);
    }
}
Back to top
View user's profile Send private message
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Sat Dec 22, 2007 5:27 pm    Post subject: Reply with quote

Hello venkat,

I'm out of idas as I never was behind a proxy... Sad
Did you put p in to the openConnection Question
Java:
URLConnection ucon = myURL.openConnection(p);
Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nitinkcv
Developer


Joined: 29 Nov 2007
Posts: 29

PostPosted: Sat Dec 29, 2007 7:46 pm    Post subject: How to get the full HTML source of the page?? Reply with quote

Hi,

I tried to get the full HTML source of a page but i was getting an IllegalArgumentException being thrown at the line
Java:

InputStream is = ucon.getInputStream();

Not sure what the prob is. It would be great if it could be solved out

Thanx,
Nitin
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Thu Jan 03, 2008 12:11 pm    Post subject: Reply with quote

Hello Nitinkcv,

thats pretty strange, as getInputStream() takes to Parameters and should not throw an IllegalArgumentException Sad

Code:
getInputStream

public InputStream getInputStream()
                           throws IOException

    Returns an input stream that reads from this open connection.

    Returns:
        an input stream that reads from this open connection.
    Throws:
        IOException - if an I/O error occurs while creating the input stream.
        UnknownServiceException - if the protocol does not support input.


Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nitinkcv
Developer


Joined: 29 Nov 2007
Posts: 29

PostPosted: Sat Jan 05, 2008 7:22 am    Post subject: Correct not getting parsed.. Reply with quote

Hi plusminus,

i was able to parse the html source, but the problem is that the correct source is not getting parsed.

My java file is:

Java:

/**
 *
 */

package com.cognizant.Transliterate;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.Reader;

import org.apache.commons.httpclient.HostConfiguration;
import org.apache.commons.httpclient.HttpConnection;
import org.apache.commons.httpclient.HttpConnectionManager;
import org.apache.commons.httpclient.HttpState;
import org.apache.commons.httpclient.HttpURL;
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.http.util.ByteArrayBuffer;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;


public class Literate1 extends Activity {

     protected static HttpConnectionManager connectionManager = new SimpleHttpConnectionManager();

     @Override
     public void onCreate(Bundle icicle) {
          super.onCreate(icicle);

          /* We will show the data we read in a TextView. */
          TextView tv = new TextView(this);
          HttpConnection connection = null;
          /* Will be filled and displayed later. */
          String myString = null;

          /* Define the URL we want to load data from. */
          String baseURL = "http://www.google.com/transliterate/indic?tlqt=1&langpair=en|ml&text=sukham%2C&tl_app=3";

          // Setup the connection

          try {
               HttpURL httpURL = new HttpURL(baseURL);
               HostConfiguration host = new HostConfiguration();
               host.setHost(httpURL.getHost(), httpURL.getPort());
               connection = connectionManager.getConnection(host);

               Log.i("MyLogger", "Before Opening Conn");

               // Open it
               connection.open();

               // Post (send) data to the connection
               PostMethod postMethod = new PostMethod(baseURL);
               
               postMethod.execute(new HttpState(), connection);

               InputStream response = postMethod.getResponseBodyAsStream();

               Log.i("MyLogger", response.toString());
               BufferedInputStream bis = new BufferedInputStream(response);
               
               ByteArrayBuffer baf = new ByteArrayBuffer(450);
               int current = 0;
               while ((current = bis.read()) != -1) {
                    baf.append((byte) current);
               }
               
               /* Convert the Bytes read to a String. */
               myString = new String(baf.toByteArray());
               bis.close();
               Log.i("MyLogger", "myString is :" + myString);
               
          } catch (Exception e) {
               Log.i("MyLogger", "myString is :" + myString);
               Log.i("MyLogger", e.toString());
               myString = e.getMessage();
          } finally {
               connection.close();
          }

          
          /* Show the String on the GUI. */
          tv.setText(myString);
          this.setContentView(tv);

     }
}


The url which i pass is http://www.google.com/transliterate/indic?tlqt=1&langpair=en|ml&text=sukham%2C&tl_app=3

Question Hmmm not able to put the above url correctly.. the full url is up till the tl_app=3 Question

But the html source that i get is not the above one's html source. i believe that the html source i get is that of this

Any Workarounds..

Thanx,
Nitin
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Sat Jan 05, 2008 1:27 pm    Post subject: Reply with quote

Hello Nitinkcv,

with me it returns: "Argument must not be null". Very probably a problem with the URL-Encoding.

Working...

Yes it is, the "|" needs to be replaced by its urlencoded-expression "%7C":
Java:
String baseURL = "http://www.google.com/transliterate/indic?tlqt=1&langpair=en|ml&text=sukham&tl_app=3";
                         baseURL = baseURL.replace("|", "%7C");
                         URL myURL = new URL(baseURL);


Returns:
Quote:
while(1);
[
{
"ew" : "sukham",
"hws" : [
"സുഖം","സുക്തം","സുക്ഹം","സുഖമ","സ്ഖം",
]
},
]

Without back-conversion of the (indian ?) html-specialchars:
Java:
while(1);
[
{
"ew" : "sukham",
"hws" : [
"&#3384;&#3393;&#3350;&#3330;", "&#3384;&#3393;&#3349;&#3405;&#3364;&#3330;", "&#3384;&#3393;&#3349;&#3405;&#3385;&#3330;", "&#3384;&#3393;&#3350;&#3374;", "&#3384;&#3405;&#3350;&#3330;",
]
},
]]


Let us know if it helped Smile

Regards,
plusminus

_________________

| Android Development Community / Tutorials


Last edited by plusminus on Sun Jan 06, 2008 7:45 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
venkat
Senior Developer


Joined: 27 Nov 2007
Posts: 152
Location: India

PostPosted: Sat Jan 05, 2008 3:10 pm    Post subject: Reply with quote

Hi Plusminus, Smile
Can you tell me , how to upload files or data from android to web server.

Thanks and Regards,
Venkat.
Back to top
View user's profile Send private message
Nitinkcv
Developer


Joined: 29 Nov 2007
Posts: 29

PostPosted: Sat Jan 05, 2008 3:19 pm    Post subject: Reply with quote

Hi PlusMinus,

Thanx for the reply Very Happy . While the app i'm getting the output without back-conversion of the html-specialchars. i.e. with the symbols &#3384 etc..

Was wondering how to get them in the respective language.. i.e. സുഖം

I believe they are unicode format. But was not able to get it still Question .

Thanx,
Nitin
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
Nitinkcv
Developer


Joined: 29 Nov 2007
Posts: 29

PostPosted: Sat Jan 05, 2008 4:51 pm    Post subject: x-ISCII91 is not registered. Reply with quote

Hmmm... Seems like x-ISCII91 is the required charset. Got this from here.

but still im getting the exception UnsupportedEncodingException.

Found this code to get all the installed charsets in the JVM.

Java:

import java.nio.charset.Charset;
import java.util.Iterator;
import java.util.Map;

public class GetAllCharSets {

  public static void main(String[] args) {
    Map charsets = Charset.availableCharsets();
    Iterator iterator = charsets.values().iterator();
    while (iterator.hasNext()) {
      Charset cs = (Charset) iterator.next();
      System.out.print(cs.displayName());
      if (cs.isRegistered()) {
        System.out.print(" (registered): ");
      } else {
        System.out.print(" (unregistered): ");
      }
      System.out.print(cs.name());
      Iterator names = cs.aliases().iterator();
      while (names.hasNext()) {
        System.out.print(", ");
        System.out.print(names.next());
      }
      System.out.println();
    }
  }
}


This is the result i got:


XML:

Big5 (registered): Big5, csBig5
Big5-HKSCS (registered): Big5-HKSCS, big5-hkscs, big5hk, big5-hkscs:unicode3.0, big5hkscs, Big5_HKSCS
EUC-JP (registered): EUC-JP, eucjis, x-eucjp, csEUCPkdFmtjapanese, eucjp, Extended_UNIX_Code_Packed_Format_for_Japanese, x-euc-jp, euc_jp
EUC-KR (registered): EUC-KR, ksc5601, 5601, ksc5601_1987, ksc_5601, ksc5601-1987, euc_kr, ks_c_5601-1987, euckr, csEUCKR
GB18030 (registered): GB18030, gb18030-2000
GB2312 (registered): GB2312, gb2312-1980, gb2312, EUC_CN, gb2312-80, euc-cn, euccn, x-EUC-CN
GBK (registered): GBK, windows-936, CP936
IBM-Thai (registered): IBM-Thai, ibm-838, ibm838, 838, cp838
IBM00858 (registered): IBM00858, cp858, ccsid00858, cp00858, 858
IBM01140 (registered): IBM01140, 1140, ccsid01140, cp01140, cp1140
IBM01141 (registered): IBM01141, cp01141, cp1141, ccsid01141, 1141
IBM01142 (registered): IBM01142, cp01142, cp1142, ccsid01142, 1142
IBM01143 (registered): IBM01143, 1143, cp01143, cp1143, ccsid01143
IBM01144 (registered): IBM01144, cp01144, cp1144, 1144, ccsid01144
IBM01145 (registered): IBM01145, ccsid01145, cp01145, 1145, cp1145
IBM01146 (registered): IBM01146, ccsid01146, cp1146, 1146, cp01146
IBM01147 (registered): IBM01147, cp1147, 1147, ccsid01147, cp01147
IBM01148 (registered): IBM01148, cp01148, cp1148, ccsid01148, 1148
IBM01149 (registered): IBM01149, cp1149, ccsid01149, 1149, cp01149
IBM037 (registered): IBM037, csIBM037, cpibm37, cp037, cs-ebcdic-cp-us, ibm-037, ibm-37, cs-ebcdic-cp-ca, cs-ebcdic-cp-wt, cs-ebcdic-cp-nl, ibm037, 037
IBM1026 (registered): IBM1026, 1026, ibm1026, cp1026, ibm-1026
IBM1047 (registered): IBM1047, 1047, ibm-1047, cp1047
IBM273 (registered): IBM273, ibm273, 273, cp273, ibm-273
IBM277 (registered): IBM277, ibm277, cp277, ibm-277, 277
IBM278 (registered): IBM278, csIBM278, ibm278, cp278, ebcdic-cp-se, 278, ibm-278, ebcdic-sv
IBM280 (registered): IBM280, ibm280, cp280, 280, ibm-280
IBM284 (registered): IBM284, cpibm284, csIBM284, ibm-284, ibm284, 284, cp284
IBM285 (registered): IBM285, 285, ebcdic-cp-gb, ibm-285, csIBM285, cp285, ibm285, cpibm285, ebcdic-gb
IBM297 (registered): IBM297, csIBM297, ebcdic-cp-fr, cp297, ibm297, ibm-297, 297, cpibm297
IBM420 (registered): IBM420, ibm420, 420, ebcdic-cp-ar1, csIBM420, ibm-420, cp420
IBM424 (registered): IBM424, cp424, 424, ebcdic-cp-he, ibm424, csIBM424, ibm-424
IBM437 (registered): IBM437, windows-437, cspc8codepage437, ibm437, cp437, 437, ibm-437
IBM500 (registered): IBM500, 500, ebcdic-cp-ch, ebcdic-cp-bh, ibm-500, csIBM500, cp500, ibm500
IBM775 (registered): IBM775, ibm775, cp775, ibm-775, 775
IBM850 (registered): IBM850, ibm-850, 850, ibm850, cspc850multilingual, cp850
IBM852 (registered): IBM852, 852, ibm-852, csPCp852, cp852, ibm852
IBM855 (registered): IBM855, 855, ibm855, cp855, cspcp855, ibm-855
IBM857 (registered): IBM857, cp857, ibm857, csIBM857, 857, ibm-857
IBM860 (registered): IBM860, ibm860, ibm-860, csIBM860, cp860, 860
IBM861 (registered): IBM861, csIBM861, ibm861, 861, cp861, ibm-861
IBM862 (registered): IBM862, cp862, ibm862, 862, ibm-862, csIBM862
IBM863 (registered): IBM863, cp863, csIBM863, ibm863, 863, ibm-863
IBM864 (registered): IBM864, csIBM864, ibm-864, 864, ibm864, cp864
IBM865 (registered): IBM865, ibm-865, csIBM865, 865, ibm865, cp865
IBM866 (registered): IBM866, 866, ibm-866, csIBM866, ibm866, cp866
IBM868 (registered): IBM868, cp-ar, 868, ibm868, csIBM868, ibm-868, cp868
IBM869 (registered): IBM869, ibm869, ibm-869, 869, cp869, csIBM869, cp-gr
IBM870 (registered): IBM870, ebcdic-cp-yu, ibm870, ibm-870, 870, csIBM870, cp870, ebcdic-cp-roece
IBM871 (registered): IBM871, csIBM871, ibm-871, cp871, ebcdic-cp-is, 871, ibm871
IBM918 (registered): IBM918, ibm-918, 918, cp918, ebcdic-cp-ar2
ISO-2022-CN (registered): ISO-2022-CN, csISO2022CN, ISO2022CN
ISO-2022-JP (registered): ISO-2022-JP, jis, jis_encoding, csjisencoding, csISO2022JP, iso2022jp
ISO-2022-KR (registered): ISO-2022-KR, ISO2022KR, csISO2022KR
ISO-8859-1 (registered): ISO-8859-1, iso-ir-100, 8859_1, ISO_8859-1, ISO8859_1, 819, csISOLatin1, IBM-819, ISO_8859-1:1987, latin1, cp819, ISO8859-1, IBM819, ISO_8859_1, l1
ISO-8859-13 (registered): ISO-8859-13, ISO8859-13, 8859_13, iso8859_13, iso_8859-13
ISO-8859-15 (registered): ISO-8859-15, 8859_15, csISOlatin9, IBM923, cp923, 923, L9, IBM-923, ISO8859-15, LATIN9, ISO_8859-15, LATIN0, csISOlatin0, ISO8859_15_FDIS, ISO-8859-15, ISO8859_15
ISO-8859-2 (registered): ISO-8859-2, ibm912, l2, ibm-912, cp912, ISO_8859-2:1987, ISO_8859-2, latin2, csISOLatin2, iso8859_2, 912, 8859_2, ISO8859-2, iso-ir-101
ISO-8859-3 (registered): ISO-8859-3, iso8859_3, cp913, csISOLatin3, ibm-913, ISO_8859-3, 913, ISO8859-3, 8859_3, ibm913, iso-ir-109, ISO_8859-3:1988, latin3, l3
ISO-8859-4 (registered): ISO-8859-4, iso-ir-110, l4, 8859_4, ibm914, latin4, ibm-914, csISOLatin4, iso8859_4, iso8859-4, cp914, 914, ISO_8859-4:1988, ISO_8859-4
ISO-8859-5 (registered): ISO-8859-5, 915, ISO_8859-5:1988, iso8859_5, cp915, ibm915, ISO_8859-5, ISO8859-5, csISOLatinCyrillic, cyrillic, 8859_5, iso-ir-144, ibm-915
ISO-8859-6 (registered): ISO-8859-6, 8859_6, arabic, ibm-1089, iso8859_6, ISO_8859-6, iso-ir-127, ibm1089, ISO_8859-6:1987, ECMA-114, 1089, csISOLatinArabic, ISO8859-6, ASMO-708, cp1089
ISO-8859-7 (registered): ISO-8859-7, sun_eu_greek, 8859_7, iso-ir-126, ISO_8859-7:1987, ibm-813, iso8859_7, ISO_8859-7, csISOLatinGreek, greek8, ECMA-118, ibm813, ELOT_928, iso8859-7, cp813, greek, 813
ISO-8859-8 (registered): ISO-8859-8, iso-ir-138, ibm-916, iso8859_8, cp916, ISO8859-8, ISO_8859-8:1988, hebrew, 8859_8, csISOLatinHebrew, ibm916, 916, ISO_8859-8
ISO-8859-9 (registered): ISO-8859-9, cp920, l5, ISO_8859-9, ibm-920, csISOLatin5, 8859_9, iso-ir-148, latin5, 920, ISO8859-9, ibm920, ISO_8859-9:1989, iso8859_9
JIS_X0201 (registered): JIS_X0201, JIS_X0201, X0201, JIS0201, csHalfWidthKatakana
JIS_X0212-1990 (registered): JIS_X0212-1990, jis_x0212-1990, iso-ir-159, x0212, JIS0212, csISO159JISX02121990
KOI8-R (registered): KOI8-R, koi8, koi8_r, cskoi8r
Shift_JIS (registered): Shift_JIS, shift-jis, shift_jis, x-sjis, ms_kanji, csShiftJIS, sjis
TIS-620 (registered): TIS-620, tis620.2533, tis620
US-ASCII (registered): US-ASCII, ISO646-US, IBM367, ASCII, cp367, default, ascii7, ANSI_X3.4-1986, iso-ir-6, us, 646, iso_646.irv:1983, csASCII, ANSI_X3.4-1968, ISO_646.irv:1991
UTF-16 (registered): UTF-16, utf16, UTF_16
UTF-16BE (registered): UTF-16BE, X-UTF-16BE, UnicodeBigUnmarked, UTF_16BE, ISO-10646-UCS-2
UTF-16LE (registered): UTF-16LE, UnicodeLittleUnmarked, X-UTF-16LE, UTF_16LE
UTF-8 (registered): UTF-8, UTF8, unicode-1-1-utf-8
windows-1250 (registered): windows-1250, cp1250, cp5346
windows-1251 (registered): windows-1251, ansi-1251, cp1251, cp5347
windows-1252 (registered): windows-1252, cp1252, cp5348
windows-1253 (registered): windows-1253, cp1253, cp5349
windows-1254 (registered): windows-1254, cp5350, cp1254
windows-1255 (registered): windows-1255, cp1255
windows-1256 (registered): windows-1256, cp1256
windows-1257 (registered): windows-1257, cp1257, cp5353
windows-1258 (registered): windows-1258, cp1258
windows-31j (registered): windows-31j, csWindows31J, windows-932, MS932
x-Big5-Solaris (unregistered): x-Big5-Solaris, Big5_Solaris
x-euc-jp-linux (unregistered): x-euc-jp-linux, euc_jp_linux, euc-jp-linux
x-EUC-TW (unregistered): x-EUC-TW, cns11643, euc_tw, EUC-TW, euctw
x-eucJP-Open (unregistered): x-eucJP-Open, EUC_JP_Solaris, eucJP-open
x-IBM1006 (unregistered): x-IBM1006, cp1006, ibm1006, 1006, ibm-1006
x-IBM1025 (unregistered): x-IBM1025, ibm1025, 1025, cp1025, ibm-1025
x-IBM1046 (unregistered): x-IBM1046, ibm1046, 1046, cp1046, ibm-1046
x-IBM1097 (unregistered): x-IBM1097, ibm1097, 1097, cp1097, ibm-1097
x-IBM1098 (unregistered): x-IBM1098, cp1098, ibm-1098, ibm1098, 1098
x-IBM1112 (unregistered): x-IBM1112, cp1112, 1112, ibm1112, ibm-1112
x-IBM1122 (unregistered): x-IBM1122, ibm-1122, 1122, cp1122, ibm1122
x-IBM1123 (unregistered): x-IBM1123, cp1123, ibm1123, ibm-1123, 1123
x-IBM1124 (unregistered): x-IBM1124, cp1124, ibm1124, ibm-1124, 1124
x-IBM1381 (unregistered): x-IBM1381, 1381, cp1381, ibm1381, ibm-1381
x-IBM1383 (unregistered): x-IBM1383, ibm1383, ibm-1383, cp1383, 1383
x-IBM33722 (unregistered): x-IBM33722, ibm-33722, cp33722, ibm-33722_vascii_vpua, ibm-5050, ibm33722, 33722
x-IBM737 (unregistered): x-IBM737, ibm-737, ibm737, cp737, 737
x-IBM834 (unregistered): x-IBM834, cp834, ibm-834, ibm834
x-IBM856 (unregistered): x-IBM856, ibm-856, 856, ibm856, cp856
x-IBM874 (unregistered): x-IBM874, cp874, ibm874, ibm-874, 874
x-IBM875 (unregistered): x-IBM875, ibm875, ibm-875, 875, cp875
x-IBM921 (unregistered): x-IBM921, 921, cp921, ibm921, ibm-921
x-IBM922 (unregistered): x-IBM922, cp922, ibm922, ibm-922, 922
x-IBM930 (unregistered): x-IBM930, cp930, 930, ibm930, ibm-930
x-IBM933 (unregistered): x-IBM933, ibm933, cp933, 933, ibm-933
x-IBM935 (unregistered): x-IBM935, 935, cp935, ibm935, ibm-935
x-IBM937 (unregistered): x-IBM937, cp937, ibm-937, ibm937, 937
x-IBM939 (unregistered): x-IBM939, ibm-939, ibm939, cp939, 939
x-IBM942 (unregistered): x-IBM942, cp942, ibm942, ibm-942, 942
x-IBM942C (unregistered): x-IBM942C, ibm942C, cp942C, ibm-942C, 942C
x-IBM943 (unregistered): x-IBM943, ibm943, ibm-943, cp943, 943
x-IBM943C (unregistered): x-IBM943C, ibm-943C, ibm943C, 943C, cp943C
x-IBM948 (unregistered): x-IBM948, 948, ibm-948, cp948, ibm948
x-IBM949 (unregistered): x-IBM949, ibm-949, cp949, 949, ibm949
x-IBM949C (unregistered): x-IBM949C, cp949C, 949C, ibm949C, ibm-949C
x-IBM950 (unregistered): x-IBM950, 950, cp950, ibm-950, ibm950
x-IBM964 (unregistered): x-IBM964, 964, cp964, ibm-964, ibm964
x-IBM970 (unregistered): x-IBM970, ibm970, 970, cp970, ibm-eucKR, ibm-970
x-ISCII91 (unregistered): x-ISCII91, iscii, ST_SEV_358-88, iso-ir-153, csISO153GOST1976874, ISCII91
x-ISO-2022-CN-CNS (unregistered): x-ISO-2022-CN-CNS, ISO2022CN_CNS, ISO-2022-CN-CNS
x-ISO-2022-CN-GB (unregistered): x-ISO-2022-CN-GB, ISO-2022-CN-GB, ISO2022CN_GB
x-iso-8859-11 (unregistered): x-iso-8859-11, iso-8859-11, iso8859_11
x-JIS0208 (unregistered): x-JIS0208, JIS0208, csISO87JISX0208, x0208, JIS_C6226-1983, JIS_X0208-1983, iso-ir-87
x-JISAutoDetect (unregistered): x-JISAutoDetect, JISAutoDetect
x-Johab (unregistered): x-Johab, johab, ms1361, ksc5601-1992, ksc5601_1992
x-MacArabic (unregistered): x-MacArabic, MacArabic
x-MacCentralEurope (unregistered): x-MacCentralEurope, MacCentralEurope
x-MacCroatian (unregistered): x-MacCroatian, MacCroatian
x-MacCyrillic (unregistered): x-MacCyrillic, MacCyrillic
x-MacDingbat (unregistered): x-MacDingbat, MacDingbat
x-MacGreek (unregistered): x-MacGreek, MacGreek
x-MacHebrew (unregistered): x-MacHebrew, MacHebrew
x-MacIceland (unregistered): x-MacIceland, MacIceland
x-MacRoman (unregistered): x-MacRoman, MacRoman
x-MacRomania (unregistered): x-MacRomania, MacRomania
x-MacSymbol (unregistered): x-MacSymbol, MacSymbol
x-MacThai (unregistered): x-MacThai, MacThai
x-MacTurkish (unregistered): x-MacTurkish, MacTurkish
x-MacUkraine (unregistered): x-MacUkraine, MacUkraine
x-MS950-HKSCS (unregistered): x-MS950-HKSCS, MS950_HKSCS
x-mswin-936 (unregistered): x-mswin-936, ms936, ms_936
x-PCK (unregistered): x-PCK, pck
x-windows-50220 (unregistered): x-windows-50220, cp50220, ms50220
x-windows-50221 (unregistered): x-windows-50221, ms50221, cp50221
x-windows-874 (unregistered): x-windows-874, windows-874, ms874, ms-874
x-windows-949 (unregistered): x-windows-949, windows949, ms_949, ms949
x-windows-950 (unregistered): x-windows-950, windows-950, ms950
x-windows-iso2022jp (unregistered): x-windows-iso2022jp, windows-iso2022jp


But the charset x-ISCII91 is unregistered. So could that be the reason that im not gettin it right. Also i put an entry in the strings.xml..


<string name="default_output">സുഖം</string>


and tried to display that in the emulator but it displayed the notorious SQUARE BOXES Sad

So does that mean android doesnt support indic charset or do i have to some make that x-ISCII91 'REGISTERED' instead of 'UNREGISTERED'...

Will investigate more and come back.

Thnax,
Nitin
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
plusminus
Site Admin


Joined: 14 Nov 2007
Posts: 2067
Location: Germany

PostPosted: Sun Jan 06, 2008 1:03 pm    Post subject: Reply with quote

Hello Nitin,

as this page uses
Quote:
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

and the chars from my post above get displayed correctly and "iso-8859-1" it is listed in your output as "registered" it should work.

Especially when you display it within a WebView, you can set the charset yourself.
Does UTF-8 not work Question

Regards,
plusminus

_________________

| Android Development Community / Tutorials
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Nitinkcv
Developer


Joined: 29 Nov 2007
Posts: 29