Skip to content

UTF-16LE Regexp not working as expected #2863

@zako42

Description

@zako42

Not able to create a UTF-16LE encoded Regexp object. I tried the following in Jruby 1.7.19 in IRB:

abc8 = "abc"
abc8.encoding  # <Encoding:UTF-8>
regex8 = Regexp.new(abc8)  # succeeds

abc16 = "abc".encode("UTF-16LE")
abc16.encoding  # <Encoding:UTF-16LE>
regex16 = Regexp.new(abc16)
# in MRI 1.9.3-p545 this succeeds
# in jruby 1.7.19:  Encoding::CompatibilityError: incompatible character encodings: US-ASCII and UTF-16LE

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions