Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

  is converted to 0xA0 in InnerText #493

Open
tamws27 opened this issue Jan 8, 2023 · 1 comment
Open

  is converted to 0xA0 in InnerText #493

tamws27 opened this issue Jan 8, 2023 · 1 comment
Assignees

Comments

@tamws27
Copy link

tamws27 commented Jan 8, 2023

I found a quite weird problem.

I follow the guide "Decode and strip HTML" example to decode the html before loading
https://html-agility-pack.net/online-examples

HtmlDocument doc = new HtmlDocument();
string subcriterionCritiqueDecode = WebUtility.HtmlDecode(page); // decode html first before loadHtml
doc.LoadHtml(subcriterionCritiqueDecode);

I have some html code like this inside a <td>:
<td>1.0 through&nbsp; version 2.0</td>

I expect the &nbsp; will be converted to space (hex: 0x20) in the InnerText, however I found that the HAP converted it into 0xA0! (I checked by showing the hex value using Console.WriteLine("{0:X2}", (int)ch);

HAP version: 1.11.46
.NET version: 7.0.1

@elgonzo
Copy link
Contributor

elgonzo commented Jan 8, 2023

(Edit: Oops, i did read your issue report wrong, and i wrote an incorrect comment, which i deleted)

Your expectation is wrong. There is no problem.

&nbsp; is the HTML entity for the no-break space character, and the Unicode character code for the no-break space character is indeed 0xA0.

(Please be so kind and close your issue report, as it is based on an incorrect assumption. You as the author of the issue report should see the close button at the bottom of this issue thread. Thanks!)

@JonathanMagnan JonathanMagnan self-assigned this Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants