dotnet / dotnet/maui

Html encoded less than character "<" does not display in a Label when followed by a character immediately after

Open
#29,282 4 comments 0 reactions 0 assignees View on GitHub
area-controls-label platform/android s/triaged s/verified t/bug
Dominant language
C#
Stars
23.3k
Forks
2k
Avg merge
1d 15h
Merged PRs (30d)
290

Description

### Description

Attached is a repository with a repro case where, in a Maui application, a `Label` with the TextType being set to `Html` does not properly display Html encoded less than characters (`<` or the encoded value `<`) when followed immediately with another character (not a space). In the repro example I have linked below, I follow the encoded value with an `a`, so the text is set to `<a`. So it should display ``
3. Go to `MainPage.xaml.cs` and add the text to that label with an HTML encoded "less than" character, followed immediately with another character (not a space, i.e. `InvalidLabel1.Text = "Does not work => <a";`)

### Link to public reproduction project repository

https://github.com/Jadekyle24/LessThanHtmlNotDisplayingRepro/blob/master/LessThanHtmlNotDisplayingRepro/MainPage.xaml.cs

### Version with bug

9.0.51 SR5.1

### Is this a regression from previous behavior?

Not sure, did not test other versions

### Last version that worked well

Unknown/Other

### Affected platforms

Android

### Affected platform versions

This scenario was recreated on Android Version 14

### Did you find any workaround?

The workaround I found that appears to be working is, instead of just using `<` or `<`, using `<` (no ending semicolon) seems to work fine.

### Relevant log output

```shell

```

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction project, especially MainPage.xaml and MainPage.xaml.cs, and run it on Android 14 with the Label's Html text containing <a. Compare the Android result with Windows or iOS, then trace the existing Label HTML handling. Done means the encoded less-than character followed immediately by another character displays correctly on Android without breaking the other examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.