The hex edit mode has some severe issues when dealing with UTF-16 text files.

First of all, I have noticed that the sequence of "File -> Open" followed by
"View -> Hex Edit Mode" leads to completely different results than "File -> Open
in Hex Editor". Using the latter method everything works fine. However, using
"File -> Open", "View -> Hex Edit Mode" the follwing problems arise:


1) Garbled files when the UTF-16 BOM gets manipulated
-----------------------------------------------------

Steps to reproduce:

1. Get some UTF-16 encoded text file, i.e. an exported Win2000/XP registry key
(.reg file).
2. Open that file using "File -> Open" and switch to hex mode: "View -> Hex Edit
Mode".
3. Modify or delete the first two bytes (the BOM).
4. Save the file.

Result:
The whole file is garbled.

Comment:
What looks like a hex editor (that is, it reads "HEX Editor" in the status bar)
should work like a hex editor. Manipulating two bytes should modify exactly
those bytes and nothing else - even if those bytes have a special meaning in
text editing mode.


2) Garbled display when the UTF-16 BOM is incorrect
---------------------------------------------------

Steps to reproduce:

1. Take an UTF-16 encoded text file and remove the BOM using a hex editor.
Better use a "real" hex editor here, not PSPad. ;-)
2. Open that file in PSPad using "File -> Open". The content looks strange
(wrong character encoding), but that's ok, since the BOM is missing.
3. Switch to hex mode: "View -> Hex Edit Mode".

Result:
The content area is empty.

-- 
PSPad Version 4.5.2 (2240)

-- 
<http://forum.pspad.com/read.php?4,34906,34906>
PSPad freeware editor http://www.pspad.com

Odpovedet emailem