Encoding Problem Using & in an HTTP Get request [HTML entities rendered in code, log, etc]

encoding
verified

#1

Trying to set the volume for Onkyo receiver via an HTTP request (via a web server which translates this request to a TCP call the Onkyo fancy).

The working URL I want to use is:

http://192.168.1.200/MyRemote.php?command=MVL&params=33

Whenever I paste the URL string into the HTTP GET request, or into a variable with the URL, or an expression - the editor gets confused with the & sign. the letters after it seem MIA. Probably because of encoding issue.

  1. Am I doing something wrong?
  2. Is this is a bug?
    and most importantly -
  3. Is there a workaround?

thanks!


#2

Not sure it’s going to work, try escaping that & with a \


#3

Thanks eibyer!
Tried couple of escaping techniques i could think of , including \ or %26 (instead of &) etc.
Didn’t work.


#4

I was curious so I tried it with some dummy text and it looks like it’s working… at least in the editor

image


#5

thanks for helping…
now replace the string ms (after the &) with params=
and you will reproduce the bug:


#6

Ah, there it is. Maybe @ady624 or @ipaterson can help, waaay out of my league :slight_smile:


#7

This is another good example of some glitches with the expression field. An earlier bug report showed how it misbehaves when the expression text contains HTML code. I tried to update the editor component at that time but there were some customizations for webCoRE that made it difficult.

If this affects the way the URL is stored please use the Value input instead. These glitches affect only the Expression input.


#8

Thanks ipaterson for jumping on this !

unfortunately, the bug is also reproduced on value fields.
in the value field case, the editing part seems to be working:

HOWEVER when saving still getting the exact same encoding issue:


#9

That might be a different display glitch, can you check whether the request works? I suspect that it will unless you’re seeing that symbol in the value field after saving and then editing the Piston again.


#10

The variable is stored and executed in the same incorrect way:
This is why this is a show stopper for me - can’t find a workaround to this GET request.

To my unprofessional eye, it looks like the same behavior in both cases.


#11

If you’re using it for a web request an alternative would be to create command and params variables and select them as params on the request to allow webCoRE to properly serialize the parameters.

However, the most reliable workaround for your particular issue is to avoid the &para sequence. Switch the order to ?params=40&command=MVL


#12

I set up a piston to test this and it turns out that both the code and log output are indeed display issues; the Value field stores the correct value but nothing is done to escape the & symbol to avoid the browser showing it as ¶. The web request is performed with the correct URL as shown below.

I imagine that this is a fairly extensive problem to address since it affects multiple presentations of the value, so it will not be a quick fix but is quite frustrating behavior.


#13

You are absolutely correct.
The command is executed correctly.
so we are left only with the displays bug.

thanks much for helping.


#14

Yep, though to be clear the original problem of entering this in the expression input is not just a display glitch and requires a different fix, but since we’re tracking that in another issue I’ll leave this one focused on the display. The expression field becomes nearly impossible to type in once you have a few HTML tags or entities get replaced since it replaces them as you type…

Thanks for reporting and I hope you are able to work around this until it can be fixed.