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

Unmarshaling regexp loses UTF-8 encoding #4008

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

Unmarshaling regexp loses UTF-8 encoding #4008

jczyzewski opened this issue Jul 11, 2016 · 3 comments

Comments

@jczyzewski
Copy link

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
Copy link
Member

headius commented Jul 11, 2016

Good find. Will investigate.

@headius
Copy link
Member

headius commented Jul 11, 2016

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

@headius headius added this to the JRuby 9.1.3.0 milestone Jul 11, 2016
@jczyzewski
Copy link
Author

Thanks for the quick response - appreciate! 👍

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