Skip to content

iOS setValue renders numeric HTML entities emitted by Android getHTML as literal text #636

@zhenyu-hong

Description

@zhenyu-hong

Description

When HTML produced by EnrichedTextInput.getHTML() on Android contains non-ASCII text, Android serializes those characters as numeric HTML character references such as 今. If that saved HTML is later loaded into EnrichedTextInput on iOS via setValue / defaultValue, iOS renders the numeric entities literally instead of decoding them back to Unicode text.

This creates a cross-platform persistence problem: content saved from Android can look correct in an HTML renderer, but becomes unreadable when opened for editing on iOS.

Reproduction

  1. On Android, enter Chinese text in EnrichedTextInput, for example:
今晚用软尺量一次腰围
  1. Call editorRef.current.getHTML() and persist the returned value.

Observed Android HTML output includes numeric entities, for example:

<html>
<p>&#20170;&#26202;&#29992;&#36719;&#23610;&#37327;&#19968;&#27425;&#33136;&#22260;</p>
</html>
  1. On iOS, load that same saved HTML into EnrichedTextInput using setValue or defaultValue.

Expected behavior

The iOS editor should display:

今晚用软尺量一次腰围

Actual behavior

The iOS editor displays the numeric entities as literal text:

&#20170;&#26202;&#29992;&#36719;&#23610;&#37327;&#19968;&#27425;&#33136;&#22260;

Notes

This appears related to HTML entity handling, but different from #235 / #258. Those seem to cover named/special entities like &lt;, &gt;, and &amp;. In this case the problem is numeric character references emitted by Android for non-ASCII characters and then not decoded by the iOS parser.

This is especially visible with Chinese, Japanese, Korean, emoji, and other non-ASCII text.

Environment

  • react-native-enriched: 0.8.0
  • react-native: 0.85.3
  • react: 19.2.3
  • expo: 56.0.11
  • Android: observed from Android getHTML() output
  • iOS: observed when loading the saved HTML into EnrichedTextInput

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions