It is currently April 18th, 2024, 9:13 am

WebParser returns HTML value.

Get help with creating, editing & fixing problems with skins
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

WebParser returns HTML value.

Post by kyriakos876 »

Hello,
I'm parsing a URL and I get &#8211 instead of - but the text shows up correctly.
The skin is currently encoded in UCS-2 LE BOM. I tried UTF-8 but it didn't do much...
Any ideas? (Also there's Greek text being parsed, which means special characters, if that matters. Text shows up correctly though)

-Thanks in advance.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser returns HTML value.

Post by jsmorley »

kyriakos876 wrote: October 17th, 2018, 12:41 pm Hello,
I'm parsing a URL and I get &#8211 instead of - but the text shows up correctly.
The skin is currently encoded in UCS-2 LE BOM. I tried UTF-8 but it didn't do much...
Any ideas? (Also there's Greek text being parsed, which means special characters, if that matters. Text shows up correctly though)

-Thanks in advance.
This is not about encoding in the skin.

That HTML Character Reference is malformed. It should be –, and then you use https://docs.rainmeter.net/manual/measures/webparser/#DecodeCharacterReference on the child measure returning it. Sure you aren't missing the ; on the code when you are parsing it?
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: WebParser returns HTML value.

Post by kyriakos876 »

jsmorley wrote: October 17th, 2018, 12:59 pm This is not about encoding in the skin.

That HTML Character Reference is malformed. It should be –, and then you use https://docs.rainmeter.net/manual/measures/webparser/#DecodeCharacterReference on the child measure returning it. Sure you aren't missing the ; on the code when you are parsing it?
Yea sorry, I forgot the ;.
I tried DecodeCharacterReference=2 in my child measure and it worked. One question I have though is:
Do I need to decode both, numeric character references and character entity references?
Why do DecodeCharacterReference=2 and DecodeCharacterReference=3 exist? Couldn't it be DecodeCharacterReference=1? Is it doing more work to have it =1 so we prefer to specify the decoding or something?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: WebParser returns HTML value.

Post by jsmorley »

kyriakos876 wrote: October 17th, 2018, 1:10 pm Yea sorry, I forgot the ;.
I tried DecodeCharacterReference=2 in my child measure and it worked. One question I have though is:
Do I need to decode both, numeric character references and character entity references?
Why do DecodeCharacterReference=2 and DecodeCharacterReference=3 exist? Couldn't it be DecodeCharacterReference=1? Is it doing more work to have it =1 so we prefer to specify the decoding or something?
I just always use DecodeCharacterReference=1, no more work is involved. The others are there just for maximum flexibility.
User avatar
kyriakos876
Posts: 919
Joined: January 30th, 2017, 2:01 am
Location: Greece

Re: WebParser returns HTML value.

Post by kyriakos876 »

jsmorley wrote: October 17th, 2018, 1:16 pm I just always use DecodeCharacterReference=1, no more work is involved. The others are there just for maximum flexibility.
Roger that