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

Unmarshaling regexp loses UTF-8 encoding #4008

Closed
jczyzewski opened this Issue Jul 11, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@jczyzewski

jczyzewski commented Jul 11, 2016

Environment

  • JRuby version: 9.1.2.0
  • Observed on Mac OS X Yosemite, Ubuntu

Expected Behavior

When marshalling and unmarshalling an UTF-8 regexp, I expect it to preserve its UTF-8 encoding

Actual Behavior

It looks like Marshal.load loses the encoding and turns the regexp into ASCII-8BIT:

r = /\brapidísimo\b/i # => /\brapidísimo\b/i
p r.encoding # => #<Encoding:UTF-8>
p m = Marshal.dump(r) # => "\x04\bI/\x14\\brapid\xC3\xADsimo\\b\x11\x06:\x06ET"
p Marshal.load(m).encoding # => #<Encoding:ASCII-8BIT>
@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jul 11, 2016

Member

Good find. Will investigate.

Member

headius commented Jul 11, 2016

Good find. Will investigate.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jul 11, 2016

Member

Looks at though we never implemented encoding replacement for Regexp. Working on that now.

Member

headius commented Jul 11, 2016

Looks at though we never implemented encoding replacement for Regexp. Working on that now.

@headius headius closed this in c8d8226 Jul 11, 2016

@headius headius added this to the JRuby 9.1.3.0 milestone Jul 11, 2016

@headius headius removed the needs tests label Jul 11, 2016

@jczyzewski

This comment has been minimized.

Show comment
Hide comment
@jczyzewski

jczyzewski Jul 12, 2016

Thanks for the quick response - appreciate! 👍

jczyzewski commented Jul 12, 2016

Thanks for the quick response - appreciate! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment