-
Notifications
You must be signed in to change notification settings - Fork 49.1k
Closed as not planned
Labels
Resolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug
Description
React does not support all the named character references, “entities”, defined in the HTML specification:
- Table: https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
- JSON: https://html.spec.whatwg.org/entities.json
React version: 18.2.0
Steps To Reproduce
Render the following demo component and compare the exepcteds character and the actual rendering results.
Code demo
const HTMLCharRefDemo = () => (
<>
<h1>Test: HTML character references in React</h1>
<table>
<thead>
<tr>
<th>Reference</th>
<th>Expected character</th>
<th>Actual rendering</th>
</tr>
</thead>
<tbody>
<tr>
<td>&copy;</td>
<td>©</td>
<td>©</td>
</tr>
<tr>
<td>&bemptyv;</td>
<td>⦰</td>
<td>⦰</td>
</tr>
<tr>
<td>&check;</td>
<td>✓</td>
<td>✓</td>
</tr>
<tr>
<td>&bigstar;</td>
<td>★</td>
<td>★</td>
</tr>
<tr>
<td>&NoBreak;</td>
<td>{'\u2060'}</td>
<td>⁠</td>
</tr>
</tbody>
</table>
</>
);
Link to code example: https://codepen.io/valtlai/pen/qBwYezG?editors=1010
The current behavior
React does not recognize some character references but renders them as is.
The expected behavior
React should recognize all the specced character references that end with a semicolon and render the characters they represent.
Metadata
Metadata
Assignees
Labels
Resolution: StaleAutomatically closed due to inactivityAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bugA potential issue that we haven't yet confirmed as a bug