The /help /hload says "$cr and $lf characters are stripped from text when saving as plain text." but they're not being stripped when using -i as does happen by default or with -n.

This alias demonstrates this bug, but also demonstrates a quirk that appears to be difficult to demonstrate without this -i bug being present: It appears that hfree doesn't make mIRC completely forget about the contents of the table that's been hsaved to disk then hfree'ed. The alias shows that $cr and $lf within the &binvar are written to disk by the -i switch. It also shows that, even when the hsaved data is written in the format where hload-i should see there's 4 items on disk, the data gets hloaded with only 3 items off the disk, with one of the items containing $cr $lf, which could happen only if it remembered the state of the hashtable that's already been hfree'ed.

The last line of the alias shows the hsave'ed disk file in binary mode, with reversed colors at the position prior to the $cr $lf within the binary item.

/hloadi_test
/hloadi_test -n

Using no switch or using -n writes to disk with that $cr $lf stripped from disk.

/hloadi_test -i

Using the -i switch writes to disk including the $cr $lf, allowing the remainder of the binary data to simulate a 4th item, but hload won't put that 4th item into the hashtable until you hload that data after it's been copied to another file then hloaded from there.

--

And no, I'm not trying to do strange tricks like in the alias to create modified disk files. I came across this due to unexpected content of a file that had been created by hsave using the -i switch. And then, when I was creating the demo alias, I was finding that hload was 'seeing' something completely different than what was on disk.

--
Code
alias hloadi_test {
  if (-* iswm $1 ) var -s %switch $1 | else var -s %switch
  hfree -sw test | hfree -sw test2
  hmake test
  bset &v 1 97 98 99 13 10 100 101 102 61 49 50 51
  hadd -b test binary &v
  hadd test itema data
  hadd test itemz data
  echo 3 -a items before save: $hget(test,0).item
  noop $hfind(test,*,0,w,echo 3 -a $1 $hget(test,$1))
  hsave %switch test test.txt

  hmake test2
  hload %switch test2 test.txt
  echo -a items after load: $hget(test2,0).item
  noop $hget(test2,binary,&foo)
  echo -a loaded from disk: $bvar(&foo,1-) $bvar(&foo,1-).text
  noop $hfind(test2,*,0,w,echo 4 -a $1 $hget(test2,$1))

  copy -o test.txt test2.txt
  hfree -sw test2
  hmake test2
  hload %switch test2 test2.txt
  echo -a items after load same data from different file: $hget(test2,0).item
  noop $hfind(test2,*,0,w,echo 4 -a $1 $hget(test2,$1))

  bread test.txt 0 $file(test.txt).size &v
  echo -a bread: $replace($regsubex(foo,$bvar(&v,1-),/(\d+)/g,$base(\t,10,16,2)),61 62 63,61 62 63 $chr(22))
}