Array.from("a\ud83db") // node: 3 elements perry: []
[..."a\ud83db"] // correct in both
js_array_from_string_codepoints (array/alloc.rs:359) does str::from_utf8(bytes) and returns an empty array on Err — but perry's string payloads are WTF-8, so any lone surrogate makes the whole conversion silently yield nothing. The spread and for…of paths on the same string are correct, which is what makes this a wrong answer rather than a consistent limitation.
Silent: no error, just an empty array where the program expects characters.
Fix note
The walk should use wtf8_step like the other iterators. It was left out of #9427 because that same function holds a raw elements pointer and a borrow of the source payload across per-element allocations — pre-existing, but it means the change wants the RuntimeHandleScope discipline string/split.rs uses rather than a one-line swap.
Found while fixing #9409.
js_array_from_string_codepoints(array/alloc.rs:359) doesstr::from_utf8(bytes)and returns an empty array onErr— but perry's string payloads are WTF-8, so any lone surrogate makes the whole conversion silently yield nothing. The spread andfor…ofpaths on the same string are correct, which is what makes this a wrong answer rather than a consistent limitation.Silent: no error, just an empty array where the program expects characters.
Fix note
The walk should use
wtf8_steplike the other iterators. It was left out of #9427 because that same function holds a rawelementspointer and a borrow of the source payload across per-element allocations — pre-existing, but it means the change wants theRuntimeHandleScopedisciplinestring/split.rsuses rather than a one-line swap.Found while fixing #9409.