So I just tried 東京都, 日本 too (which is the Toyko default present in the skin) and it choked there too. Can WebParser support a "URL encoding" option, or is that just for things like spaces, ampersands and whatnot?jsmorley wrote: ↑August 4th, 2020, 4:45 pm Yeah, doesn't work for me either. I'm a bit stumped by this. The problem isn't the InputText plugin, it is properly setting Wrocław with the accented-L as the variable. I really have no idea why WebParser would behave any differently than your browser in this instance.
As you say, it work fine if the variable is Wroc%C5%82aw instead of Wrocław, but short of a boatload of Substitutes, I can't see a good way to get that from what the user types in.
It is currently March 6th, 2021, 11:47 am
⭐ Weather.com - Parsing the V3 JSON - NEW!
-
- Rainmeter Sage
- Posts: 1140
- Joined: March 23rd, 2015, 5:26 pm
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
-
- Developer
- Posts: 21560
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Yeah, the :EncodeURL section variable parameter only encodes "reserved characters" in a URL.SilverAzide wrote: ↑August 4th, 2020, 4:49 pm So I just tried 東京都, 日本 too (which is the Toyko default present in the skin) and it choked there too. Can WebParser support a "URL encoding" option, or is that just for things like spaces, ampersands and whatnot?
-
- Developer
- Posts: 21560
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
If I just type in Wroclaw, with a normal "l", I do get the same result, and it works in the skin. It might be that we just have to tell them that you need to use English spelling of place names, like Munich instead of München. I get no results with München either, but do with Munich.
So the long and the short of it is that the "input" must be in English, but the "output" will be in whatever language the country result is.
So the long and the short of it is that the "input" must be in English, but the "output" will be in whatever language the country result is.
-
- Rainmeter Sage
- Posts: 1140
- Joined: March 23rd, 2015, 5:26 pm
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Yeah, that's my only advice as well. So, looks like there's a need for a "percent encoding" thing for strings. Can Lua turn Unicode text (char array?) into a percent-encoded string?
-
- Developer
- Posts: 21560
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
No, Lua isn't going to help at all. It is just spectacularly bad at Unicode.SilverAzide wrote: ↑August 4th, 2020, 5:02 pm Yeah, that's my only advice as well. So, looks like there's a need for a "percent encoding" thing for strings. Can Lua turn Unicode text (char array?) into a percent-encoded string?
-
- Developer
- Posts: 21560
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
I am going to push Brian to take a look at this issue, to see what if anything can be done in WebParser.
I'm not sure what the root cause is, but I'm guessing that modern browsers might well do this:
https://www.url-encode-decode.com/
Under the covers.
OR
Perhaps WebParser is not sending the URL as UTF-8, and maybe that can be changed.
We will see if Brian can spot anything.
I'm not sure what the root cause is, but I'm guessing that modern browsers might well do this:
https://www.url-encode-decode.com/
Under the covers.
OR
Perhaps WebParser is not sending the URL as UTF-8, and maybe that can be changed.
We will see if Brian can spot anything.
-
- Rainmeter Sage
- Posts: 1140
- Joined: March 23rd, 2015, 5:26 pm
-
- Developer
- Posts: 21560
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
This simple skin will demonstrate the problem:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Variables]
Var1=Wrocław
[MeasureSite]
Measure=WebParser
URL=https://nominatim.openstreetmap.org/search.php?q=#Var1#&format=json
Flags=Resync | NoCookies
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
RegExp=(?siU)^(.*)$
StringIndex=1
[MeterDisplay]
Meter=String
MeasureName=MeasureSite
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Result : %1
LeftMouseUpAction=[https://nominatim.openstreetmap.org/search.php?q=#Var1#&format=json]
-
- Rainmeter Sage
- Posts: 1140
- Joined: March 23rd, 2015, 5:26 pm
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
I didn't try modding this example (just spit-balling here), but if anyone wants to brute force it, you can use curl in PowerShell to grab the JSON and parse that.
Something like:
Code: Select all
[MeasureGetLocationData]
Measure=Plugin
Plugin=RunCommand
Program=powershell.exe
Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "[Console]::OutputEncoding = New-Object -TypeName System.Text.UnicodeEncoding; (curl -Uri 'https://nominatim.openstreetmap.org/search.php?q=#Var1#&format=json').Content"
OutputType=UTF16
State=Hide
Timeout=-1
FinishAction=[...do stuff here...]
-
- Developer
- Posts: 21560
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: ⭐ Weather.com - Parsing the V3 JSON - NEW!
Yeah, I'd prefer to avoid that if possible, as that would be multiple steps. Read the results with PoweShell, have that write to a file, and have WebParser read that file to do the parsing into measures.SilverAzide wrote: ↑August 4th, 2020, 5:46 pm I didn't try modding this example (just spit-balling here), but if anyone wants to brute force it, you can use curl in PowerShell to grab the JSON and parse that.
Something like:Code: Select all
[MeasureGetLocationData] Measure=Plugin Plugin=RunCommand Program=powershell.exe Parameter="-NoProfile -ExecutionPolicy Bypass -NonInteractive -Command "[Console]::OutputEncoding = New-Object -TypeName System.Text.UnicodeEncoding; (curl -Uri 'https://nominatim.openstreetmap.org/search.php?q=#Var1#&format=json').Content" OutputType=UTF16 State=Hide Timeout=-1 FinishAction=[...do stuff here...]
I'd like to understand, and if possible fix, this issue with URL's and WebParser. This limitation isn't just in this skin, but presumably any skin that passes parameters to a URL.