lib/pedump/ne/version_info.rb in pedump-0.4.11 vs lib/pedump/ne/version_info.rb in pedump-0.4.12
- old
+ new
@@ -123,10 +123,14 @@
value_len = 0 if value_len < 0
cp = PEdump::NE.cp # XXX HACK
x.Value = f.read(value_len).to_s.chomp("\x00")
- x.Value.force_encoding("CP#{cp}").encode!('UTF-8').sub!(/\u0000$/,'') rescue nil
+ begin
+ x.Value.force_encoding("CP#{cp}").encode!('UTF-8').sub!(/\u0000$/,'')
+ rescue
+ x.Value.force_encoding("CP1250").encode!('UTF-8').sub!(/\u0000$/,'') rescue nil
+ end
if f.tell%4 > 0
f.read(4-f.tell%4) # undoc padding?
end
end
end