Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1c7661

Browse files
authored
Merge pull request #22 from ahorek/null_chars
exclude null chars
2 parents 769b6b8 + 4e31827 commit d1c7661

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/mapi/msg.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class PropertyStore
100100
# change these to use mapi symbolic const names
101101
ENCODINGS = {
102102
0x000d => proc { |obj| obj }, # seems to be used when its going to be a directory instead of a file. eg nested ole. 3701 usually. in which case we shouldn't get here right?
103-
0x001f => proc { |obj| Ole::Types::FROM_UTF16.iconv obj.read }, # unicode
103+
0x001f => proc { |obj| Ole::Types::Lpwstr.load obj.read }, # unicode
104104
# ascii
105105
# FIXME hack did a[0..-2] before, seems right sometimes, but for some others it chopped the text. chomp
106106
0x001e => proc { |obj| obj.read.chomp 0.chr },
@@ -198,7 +198,7 @@ def self.parse_nameid obj
198198
prop = if named
199199
str_off = str.unpack('V').first
200200
len = names_data[str_off, 4].unpack('V').first
201-
Ole::Types::FROM_UTF16.iconv names_data[str_off + 4, len]
201+
Ole::Types::Lpwstr.load names_data[str_off + 4, len]
202202
else
203203
a, b = str.unpack('v2')
204204
Log.debug "b not 0" if b != 0

lib/mapi/pst.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1122,7 +1122,7 @@ def handle_indirect_values key, type, value
11221122
if type == PT_STRING8
11231123
value = value.read
11241124
elsif type == PT_UNICODE
1125-
value = Ole::Types::FROM_UTF16.iconv value.read
1125+
value = Ole::Types::Lpwstr.load value.read
11261126
end
11271127
end
11281128
# special subject handling

0 commit comments

Comments
 (0)