Repository navigation
Open
Labels
bugSomething isn't working
Description
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) # WRONGObserved 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)whenfill_valueis a non-BMP Unicode character- Potentially any path that constructs
ak.Stringsfrom Pythonstr: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
- Python str → Arkouda Strings →
Test Plan
Add/enable alignment tests that must pass:
ak.full(3, "🔥").to_ndarray()equalsnp.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)
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
Closes #5261: alignment tests for arkouda.numpy.pdarraycreation (#5268)