Android Question HttpUtils2 problems

benji

Active Member
Licensed User
Longtime User
hi,
i have a problem with this sentence... if i use this in android 4.2, i don't have problems, but if i use this in 2.3.7, down execution... any idea?

B4X:
Job2.Initialize("Job2",Me)
Job2.Download("http://www.avalon.cl:8080/gprmc/Data?acct=estampa&dev=PDA01&gprmc=" & AuxSentence)

thanks in advance
 

benji

Active Member
Licensed User
Longtime User
Which error do you get?

OkHttpUtils2 should be supported by Android 2.3+.
this is ...

x6icbhy74us8w3k8kr62s_s.jpg


i was looking okhttputils2, i prefer don't change any, may be i need to change the device jajaja
 
Upvote 0

benji

Active Member
Licensed User
Longtime User
As it says: You use illegal characters. Use Download2 instead of Download as it converts the string.

By the way: Where are those commata from? ",,,,,,,,,N*53" ?

yes, i see "illegal characters", but in other device with android 4.2 i don't have it.

is GPS data, in this case, is gprmc format
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
ok, i try this... but, why works in 4.2 and not in 2.3.7?

They added more comfort for the lazy developers like me :)

However: Be careful not to use "special characters" non-escaped. It's a delight for hackers (see f.e. SQL-injection). If this is your site, you MUST check the data you get. Otherwise it is very easy to hack you site!
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
This happened to you. You have sent characters which function as control chars or just produce false values.

You send a message like this

B4X:
"http://www.avalon.cl:8080/gprmc/Data?acct=estampa&dev=PDA01&gprmc=" & AuxSentence

If I put a & in AuxSentence, how would the complete string look like?

B4X:
"http://www.avalon.cl:8080/gprmc/Data?acct=estampa&dev=PDA01&gprmc=&

Here the call would not work because & is a control value to seperate the values.

Escaping means to replace that & to chars which are harmless (here %26). The new call looks like this

B4X:
"http://www.avalon.cl:8080/gprmc/Data?acct=estampa&dev=PDA01&gprmc=%26

This is what URLENCODE in Download2 does automatic.

See here for examples: http://www.w3schools.com/tags/ref_urlencode.asp
 
Upvote 0
Top