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
Nested variable usage
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!
It is currently March 28th, 2024, 10:38 am
Variable parsing difference
- JelleDekkers
- Posts: 127
- Joined: September 27th, 2017, 6:32 pm
- Location: Netherlands
- Contact:
- Yincognito
- Rainmeter Sage
- Posts: 7017
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Variable parsing difference
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: 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.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!
- JelleDekkers
- Posts: 127
- Joined: September 27th, 2017, 6:32 pm
- Location: Netherlands
- Contact:
Re: Variable parsing difference
I had no idea that option existed, but I'm not using the beta. It's still weird that this difference in ouput occurs.
- Yincognito
- Rainmeter Sage
- Posts: 7017
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: Variable parsing difference
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.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.