pyu10055 / ntlm-http

ntlm authentication for http
13 stars 14 forks source link

unicode issue with gsub #6

Open pyu10055 opened 13 years ago

pyu10055 commented 13 years ago

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.

trampoline commented 13 years ago

fixed here : https://github.com/pyu10055/ntlm-http/pull/7