nqp
nqp copied to clipboard
[JVM] Reimplement nqp::encode for utf-16
Starting from the bug reported in https://github.com/Raku/nqp/issues/250 it turned out that the old implementation gave different results than MoarVM for all buffer types (at least in some cases). The new code doesn't try to take shortcuts, but just works through all code points one by one, translates them to UTF-16 code points and puts those into the result buffer.
I'd guess at least the encodeUTF32 method needs a similar rework.