Skip to content

Bug: Non-BMP Unicode (Emoji) Corrupted in ak.full / ak.Strings #5266

Open

Description

@ajpotts

Bug: Non-BMP Unicode (Emoji) Corrupted in ak.full / ak.Strings

Summary

Creating Arkouda strings containing certain non-BMP Unicode characters (e.g. emoji) results in corrupted values when round-tripped to NumPy/Python.

Example: ak.full(3, "🔥") produces ['\uf525', '\uf525', '\uf525'] instead of ['🔥', '🔥', '🔥'].

Repro

Expected (NumPy / Python)

import numpy as np
np.full(3, "🔥", dtype=object)
# array(['🔥', '🔥', '🔥'], dtype=object)

Actual (Arkouda)

import arkouda as ak
import numpy as np

x = ak.full(3, "🔥")
x.to_ndarray()
# array(['\uf525', '\uf525', '\uf525'], dtype=object)   # WRONG

Observed in alignment test:

  • expected code point: U+1F525 (FIRE, "🔥")
  • actual code point: U+F525 (Private Use Area char "\uf525")

Impact

  • Incorrect string values for emoji / other non-BMP code points (> U+FFFF)
  • Breaks NumPy/pandas alignment for string operations and round-trips
  • Can silently corrupt user data

Likely Root Cause (Hypothesis)

A UTF-16 / surrogate-handling or truncation issue where a 32-bit code point is being stored/decoded as a 16-bit unit, dropping the high bits (e.g. U+1F525 → U+F525).

Scope / Where It Shows Up

  • ak.full(shape, fill_value) when fill_value is a non-BMP Unicode character
  • Potentially any path that constructs ak.Strings from Python str:
    • ak.array(np.array([...], dtype="U"))
    • ak.Strings.from_list
    • server-side string creation / broadcast paths
    • to_ndarray() / client decode

Suggested Fix Direction

  • Ensure strings are encoded/decoded as UTF-8 end-to-end
  • Avoid UTF-16 code unit storage unless surrogate pairs are handled correctly
  • Add explicit tests for non-BMP code points:
    • emoji (🔥, 😀, 🧪)
    • musical symbols, rare scripts
  • Verify round-trip identity:
    • Python str → Arkouda Strings → to_ndarray() → Python str

Test Plan

Add/enable alignment tests that must pass:

  • ak.full(3, "🔥").to_ndarray() equals np.full(3, "🔥", dtype=object)
  • Similar for multi-character strings containing emoji: "hi🔥"
  • Mixed arrays: ["a", "🔥", "bb"]

Temporary Workaround

In the NumPy alignment suite, mark emoji/non-BMP cases as xfail with a link to this issue until fixed.

Acceptance Criteria

  • Non-BMP Unicode characters are preserved exactly through creation and round-trip
  • Alignment tests for emoji pass (remove xfail)

Activity

  1. added
    bug
    on Jan 8, 2026
  2. added a commit that references this issue on Feb 13, 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

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions