Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding::Converter#primitive_convert has trailing null byte #2764

Closed
nirvdrum opened this issue Mar 26, 2015 · 1 comment
Closed

Encoding::Converter#primitive_convert has trailing null byte #2764

nirvdrum opened this issue Mar 26, 2015 · 1 comment

Comments

@nirvdrum
Copy link
Contributor

Encoding::Converter#primitive_convert seems to have a trailing null byte. More accurately, the ByteList end pointer seems to be off by one.

str = "あいうえお"
dst = ""
ec = Encoding::Converter.new str.encoding, Encoding::ISO_2022_JP, 0
ec.primitive_convert str.dup, dst, nil, nil, 0
p dst 0

MRI 2.2.1:

> ruby -v
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

> ruby yo.rb 
"\e\x24\x42\x24\x22\x24\x24\x24\x26\x24\x28\x24\x2A\e\x28\x42"

JRuby 9k:

> bin/jruby -v
jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-03-26 20c6a62 Java HotSpot(TM) 64-Bit Server VM 24.76-b04 on 1.7.0_76-b13 +jit [linux-amd64]

> bin/jruby yo.rb 
"\e\x24\x42\x24\x22\x24\x24\x24\x26\x24\x28\x24\x2A\e\x28\x42\x00"
@headius
Copy link
Member

headius commented Mar 29, 2015

Probably an issue in the stateful finishing logic for ISO-2022-JP.

@headius headius added this to the 9.0.0.0.pre2 milestone Mar 29, 2015
headius added a commit that referenced this issue Mar 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants