Fix utf16_string_value_ptr() for TruffleRuby#334
Fix utf16_string_value_ptr() for TruffleRuby#334flavorjones merged 1 commit intosparklemotion:masterfrom
Conversation
|
From truffleruby/truffleruby#2704 (comment) Maybe it was added in 1.8 days where there was no good encoding/transcoding support in Ruby? |
|
Ah, the side effect of |
|
FWIW CRuby master seems to have |
That seems easy to fix, so I have an incoming fix for that in TruffleRuby. |
|
@eregon Can you please add a test for this behavior? |
|
I see the commment at truffleruby/truffleruby#2704 (comment) explaining the source of the problem. No worries, I'll work through it. |
* TruffleRuby uses TruffleString which requires all UTF-16 strings to always have an even bytesize. * The code here ensures the UTF-16 string always ends up with 2 \x00 bytes, so append them explicitly to have an even bytesize instead of relying on RSTRING_PTR() adding the second \x00 byte. * Fixes truffleruby/truffleruby#2704
2f67cd0 to
5aa746f
Compare
|
Thank you! |
always have an even bytesize.
bytes, so append them explicitly to have an even bytesize instead of
relying on RSTRING_PTR() adding the second \x00 byte.
This fixes the CI on TruffleRuby.