Author Topic: Hex view on xml files  (Read 7071 times)

jacobskjoet

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Hex view on xml files
« on: September 28, 2006, 09:46:06 AM »
Dear Community

When opening a XML file in SE 11 the hex view option is disabled. I been going though the file extension setup to find out why this is so - but in vain.

The online manual supplies no clue to this problem.

Can anyone give a pointer, please ?

Regards Jacob


hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Hex view on xml files
« Reply #1 on: September 28, 2006, 11:17:20 AM »
No problem here (v11.02) ???
You could try the 'hex' command on cmdline...

HS2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Hex view on xml files
« Reply #2 on: September 28, 2006, 07:02:41 PM »
For now, to edit a file like this one in hex.  Close the file and then use the open dialog and set the encoding to "Binary SBCS/DBCS mode".  Now you will be able to view your file in hex.

This is a very normal confusion.  When you open an XML file, SlickEdit must convert the file to it's own internal Unicode representation.  In SlickEdit's case, it stores Unicode as Utf-8.  When the encoding of the original XML files is also Utf-8, then you can flip into hex mode.  However, if the encoding of the XML file was some codepage or say unicode stored in Utf-16, then SlickEdit has to convert the data to UTF-8 when you open the file.  For this case, flipping into hex mode would require retranslating the file back to UTF-16.  Given that the original file size could be up to 2 gig, this is a bit of a problem.

In the future, SlickEdit could attempt to handle this situation.  A Reasonable approach would be for SlickEdit to require you save the file if it is modified and then SlickEdit would reopen the file in binary.  When switching out of hex mode, SlickEdit would require you to save the file if it is modified, and then reopen the XML file in Unicode mode.  This would be slow (especially for large files) but it is a very reasonable and effective solution.  Unfortunately, you loose undo information when closing and reopening a file.  If you're thinking about this problem, you'll realize that SlickEdit would also have to restore the cursor position which is a bit tricky.  This is all doable but it just hasn't been done yet.

jacobskjoet

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Hex view on xml files
« Reply #3 on: September 30, 2006, 08:32:39 AM »
Hi Clark

I see the complexity.

I create simple non unicode XML files in an embedded app and occasionally needs to verify the output.

Opening using another encoding is not a problem as SE also seems to remembers this choice.

Renaming the files was a pain though - thank you :-)

Regards Jacob