Skip to content

[iOS] Named entity   rendered literally, then saved as   #818

Closed

Description

@henrikra

Before submitting a new issue

Bug summary

On iOS, EnrichedTextInput (and EnrichedText) render the named character reference   as the literal six characters  . The next getHTML() / onChangeHtml then escapes the &, so the stored HTML becomes  . After that, the literal text shows up on every platform, because it is now real text.

  is very common input. The HTML serialization algorithm (WHATWG "escaping a string") writes U+00A0 as  . So HTML produced on the web (innerHTML, this library's web editor, Tiptap/ProseMirror getHTML()) contains it whenever the text has a non-breaking space. Browsers insert one for a trailing or double space typed in a contenteditable. This library's Android serializer (EnrichedParser.withinStyle) also writes runs of spaces as  . So content written on web or Android and then edited on iOS gets corrupted.

Cause: getEscapedCharactersInfoFrom in ios/extensions/StringExtension.mm only maps &, < and >, plus numeric references. Android (TagSoup) and web (DOMParser) decode named references.

Suggested fix: add at least   → U+00A0, " → " and ' → ' to unescapeMap. Ideally, decode the full HTML5 named-reference table.

Workaround we use for now: before passing HTML to the component, rewrite   / " / ' to   / " / ', which iOS already decodes.

Library version

1.1.1

Environment info

react-native 0.86.2
expo 57.0.14 (dev client, new architecture)
react 19.2.3
iOS Simulator 18.6 (iPhone 16 Pro); also seen on a physical iPhone running iOS 26

Steps to reproduce

  1. On iOS, render an EnrichedTextInput with:
    <EnrichedTextInput defaultValue={'<html><p>Hello&nbsp;world</p></html>'} onChangeHtml={(e) => console.log(e.nativeEvent.value)} />
  2. Observed: the input shows Hello&nbsp;world. Expected: Hello world, with a non-breaking space.
  3. Type one character. Observed in onChangeHtml: …Hello&amp;nbsp;world…. Expected: U+00A0 (or &nbsp;), not &amp;nbsp;.
  4. The same HTML on Android and web renders correctly.

Reproducible example repository

No standalone repo yet. The steps above use the stock component only, with no app code involved.

Activity

  1. hejsztynx commented on Oct 19, 2026

    @hejsztynx
    Collaborator

    Hi @henrikra ! Thank you for submitting this issue. I agree, this is a bug and we'll get it fixed

  2. added theissue type on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions