It is currently November 25th, 2020, 1:51 pm

Variable parsing difference

Report bugs with the Rainmeter application and suggest features.
User avatar
JelleDekkers
Posts: 63
Joined: September 27th, 2017, 6:32 pm

Variable parsing difference

Post by JelleDekkers »

So I was just casually writing a weather parser for Weather.com when I noticed something: languages with special characters (Hindi in this case) are written with Unicode character references instead of the characters themselves.

When trying to replace those references with the characters, the following happened:

"Normal" variable usage
Image

Nested variable usage
Image

Notice the output of the highlighted measure in the log. For some unknown reason, the "normal" way does not give me the desired result, but the nested approach does!
User avatar
Yincognito
Posts: 2931
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Variable parsing difference

Post by Yincognito »

JelleDekkers wrote: October 28th, 2020, 1:58 pm So I was just casually writing a weather parser for Weather.com when I noticed something: languages with special characters (Hindi in this case) are written with Unicode character references instead of the characters themselves.

When trying to replace those references with the characters, the following happened:
[...]
Notice the output of the highlighted measure in the log. For some unknown reason, the "normal" way does not give me the desired result, but the nested approach does!
This (i.e. Unicode characters being written as \uNNNN in weather.com page source) is not unusual, and it has been discussed and solved actually (can't remember the exact thread and page). Just use the "new" DecodeCodePoints option in the child WebParser measures and it will work:
DecodeCodePoints.jpg
Indian Weather & Characters.jpg
As for the nested syntax, this is probably due to the fact that the nested variable is parsed in a dynamic way before being nested into the other variable, so the character references are replaced with the actual characters.
You do not have the required permissions to view the files attached to this post.
User avatar
JelleDekkers
Posts: 63
Joined: September 27th, 2017, 6:32 pm

Re: Variable parsing difference

Post by JelleDekkers »

I had no idea that option existed, but I'm not using the beta. It's still weird that this difference in ouput occurs.
User avatar
Yincognito
Posts: 2931
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Variable parsing difference

Post by Yincognito »

JelleDekkers wrote: October 28th, 2020, 3:45 pm I had no idea that option existed, but I'm not using the beta. It's still weird that this difference in ouput occurs.
It doesn't seem weird to me anymore, after better understanding the order in which things happen in Rainmeter and how the nested syntax works.