Skip to content

unicode issue with gsub #6

@pyu10055

Description

@pyu10055

The BOM fix that's been applied to ntlm.rb breaks with error:

/pyu-ntlm-http-0.1.3.1/lib/net/ntlm.rb:104:in `gsub': incompatible encoding regexp match (ASCII-8BIT regexp with UTF-16BE string) (Encoding::CompatibilityError)
You probably need to do something like this to resolve:

regex = Regexp.new(Kconv.kconv("^\376\377", Kconv::UTF16, Kconv::ASCII))
swap16(Kconv.kconv(str, Kconv::UTF16, Kconv::ASCII).gsub(regex,''))
I'm on Ruby 1.9.2 running on Windows 7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions