-->
Page 1 of 3

Problem with "=" in strings

PostPosted: Sat Jan 07, 2017 8:12 am
by bugs
Trying (and failing) to get a string into an SQL database using wget with a fixed string & a variable.
Code: Select allwg$ = "xxxx.co.uk/log.php?text="
a$ = "just_a_test"
b$ = wg$ & a$
rec = wget(b$)

Examining the combined string,
xxxx.co.uk/log.php?text = just_a_test
there are spaces added either side of the = sign so the command does not get transmitted correctly.

This simple code shows the error in the length of the second string:-
Code: Select alla$ = "z=z"
wprint "a$ is "
wprint a$
wprint "<br>"
                                          'displays correct length of 3 characters
wprint "length of a$ is "
wprint len(a$)
wprint "<br>"
wprint "<br>"

b$ = "="
a$ = "z" & b$ & "z"
wprint "a$ is "
wprint a$
wprint "<br>"
                                      'displays length of 5 with the additional spaces
wprint "length of a$ is "
wprint len(a$)
wprint "<br>"

end


Re: Problem with "=" in strings

PostPosted: Sat Jan 07, 2017 1:05 pm
by bugs
Update - I can work round it by using chr(61) instead of "=".
e.g.
Code: Select allwg$ = "xxxx.co.uk/log.php?text" & chr(61)
a$ = "just_a_test"
b$ = wg$ & a$
rec = wget(b$)


:)

Re: Problem with "=" in strings

PostPosted: Sun Jan 08, 2017 3:17 pm
by Luc Volders
He bugs,

What branch are you using.
I just tried the unmodified copy of your program and here is my outcome:

Code: Select alla$ is z=z
length of a$ is 3

a$ is z=z
length of a$ is 3


I am using:
ESP Basic 3.0.Alpha 65

So in my opinion and version it just works fine.

Luc

Re: Problem with "=" in strings

PostPosted: Sun Jan 08, 2017 4:33 pm
by bugs
Hi - many thanks for trying the code.

There is something strange going on - I am also using A65 and have even tried different browsers.

BUT - if I copy and paste the code as you did - it works correctly!
If I re-load the original program and even re-type it the error returns.
The only thing I can think now is something to do with a character set?
Tomorrow I will try copying the code into an editor that will give me character set information.

Again, thanks for the assistance.