Hi,

I wrote this function in order to retrieve data from a web server:

    String getWebData(String arg)
    {
        URL url;
        String retVal;
        try 
        {
            url = new URL(arg);
            HttpURLConnection conexion = (HttpURLConnection) 
url.openConnection();
            InputStream instream = new 
BufferedInputStream(conexion.getInputStream());
            InputStreamReader rdr = new InputStreamReader(instream);
            char[] buff = new char[32767];
            rdr.read(buff);
            conexion.disconnect();
            retVal = new String(buff);
        }
        catch (Exception e){
            retVal = "EXCEP: " + e.toString();
        }
        return retVal;
    }

it takes arguments like 
http://somewebsite.com/someprog.php?arg1=this&arg2=that.

In some particular cases, when the third argument is a business name, it 
fails (e.g.)
http://www.mypage.com.ve/procesarActivacion.php?usrid=xxx&pwd=zzz&serial=PR333-RU26&empresa=Cafe
 
Oaxaca DBL, c.a.

By modifying the contents of "empresa", in the very same instance of the 
application, it works with:
http://www.mypage.com.ve/procesarActivacion.php?usrid=xxx&pwd=zzz&serial=PR333-RU26&empresa=Oaxaca

When entering the complete string in a browser, I get proper results in all 
cases.

I wrote an "ad hoc" encoding function in order to supress the potentially 
offending chars (spaces, periods and commas, replaced by /SP/, /DOT/ and 
/COMA/ respectively), and use a matching decoder in the to restore the 
original values. It worked a couple of times, but then it went back to the 
initial situation.

Is this behaviour known? Any workaround suggested? Is there any other set 
of classes or standard library that allows me to retrieve data from a web 
server?

TIA
--

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to