Fixed encoding of directories ending in .d or .i:
One .d and .i was mixed up, and string replace method doesn't work in-place.
+ hg init
+ hg add a
+ hg commit -m commit #0 -d 0 0
+ hg add b
+ hg commit -m commit #1 -d 0 0
+ hg update 0
+ hg add b
+ hg commit -m commit #2 -d 0 0
+ hg init
+ hg add a
+ hg commit -m commit #0 -d 0 0
+ hg add b
+ hg commit -m commit #1 -d 0 0
+ hg update 0
+ hg commit -A -m commit #2 -d 0 0
adding b
+ hg init
+ hg add a
+ hg commit -m commit #0 -d 0 0
+ hg add b
+ hg commit -m commit #1 -d 0 0
+ hg remove b
+ hg update 0
+ hg commit -A -m commit #2 -d 0 0
adding b