Troglodyne-Internet-Widgets / selenium-client-perl

WC3 Selenium client for Perl
6 stars 4 forks source link

Parsing of undecoded UTF-8 will give garbage when decoding entities at /usr/share/perl5/Selenium/Specification.pm line 136. #8

Closed cgf1 closed 3 years ago

cgf1 commented 3 years ago

I got the error in the subject from a client site. The attached patch fixes it but I'm not sure if it is the right solution or not. p.txt

That assumes that every web site will be using utf8 encoding which I'm not sure is correct.

teodesian commented 3 years ago

This should probably be the default, but with a setting for when you absolutely positively need something else.

I'll look at adding this soon, thanks

cgf1 commented 3 years ago

Sounds like the right solution. Thanks.

teodesian commented 3 years ago

Given the description, I'm not sure the attached patch is the right move, as that's bit of code simply fetches the description of the spec from the WC3. This should only be done once on given installs, rather than on every instantiation of a Selenium::Client or fetch of a page.

If we had something happening per fetch, it would mean the selenium servers themselves are returning UTF8 which is not being handled correctly by the JSON decoder.

If this is what's going on with your client, there is a more elegant fix.

It would be helpful to get the right fix if I had the precise error messaging. If it's something like "wide character in"... during the HTML::Parser logic discerning the spec, then this is probably the answer.

That said, I don't encounter this myself on any of my test systems, so I am not sure this is the case / have no way of knowing.

teodesian commented 3 years ago

Try out the above patch in 058284e, see if that works.

I tried to do things the "right" way all around.

cgf1 commented 3 years ago

Sorry that I haven't responded more quickly to this. The subject of this bug was the error I saw. I have only seen it on one site that I tested. I'll try your patch in the next couple of days.

teodesian commented 3 years ago

Resolving, will push what I've got, having heard no opposition.