https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112012-09-30T20:30:00ZRuby Issue Tracking SystemRuby master - Bug #7090: UTF-16LE String#<< append 0x0 for certain codepointshttps://bugs.ruby-lang.org/issues/7090?journal_id=298072012-09-30T20:30:00Zstefan (Stefan Lang)langstefan@gmx.at
<ul></ul><p>UTF-16BE</p>
<p>irb(main):003:0> s = "".force_encoding('utf-16be')<br>
=> ""<br>
irb(main):004:0> s << 0x20<br>
=> "\u0000"<br>
irb(main):005:0> s << 0x300<br>
=> "\u0000\u0300"</p> Ruby master - Bug #7090: UTF-16LE String#<< append 0x0 for certain codepointshttps://bugs.ruby-lang.org/issues/7090?journal_id=298082012-09-30T20:34:36Zstefan (Stefan Lang)langstefan@gmx.at
<ul></ul><p>With older Ruby version: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]</p>
<p>the string correctly contains 0x20, 0x300 for UTF-8, UTF-16LE and UTF-16BE.</p> Ruby master - Bug #7090: UTF-16LE String#<< append 0x0 for certain codepointshttps://bugs.ruby-lang.org/issues/7090?journal_id=298092012-09-30T21:20:13Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r37058.<br>
Stefan, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<ul>
<li>string.c (rb_str_concat): use memcpy to copy a string which contains<br>
NUL characters. <a href="/issues/7090">[ruby-core:47751]</a> [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: UTF-16LE String#<< append 0x0 for certain codepoints (Closed)" href="https://bugs.ruby-lang.org/issues/7090">#7090</a>]</li>
</ul>