Author Topic: Can't view HEX in XML mode?  (Read 3256 times)

mark0978

  • Community Member
  • Posts: 98
  • Hero Points: -2
Can't view HEX in XML mode?
« on: March 21, 2010, 06:00:25 pm »
Trying to edit a botched .vcproj file (CVS merge),  View HEX is disabled.....  Seems like maybe it is tied up in the file encoding.  Not sure why that should disable viewing the file in hex though.....


Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Can't view HEX in XML mode?
« Reply #1 on: March 22, 2010, 04:02:48 pm »
Most likely the project and/or solution file was saved as UTF-16. I've seen Visual Studio do this sort of thing where you save a file explicitly as UTF-16, and then each subsequent save picks up this setting, including files you don't edit in the text editor.

Try saving the file (in SlickEdit) as UTF-8, and then you can activate the hex view. Once the project is repaired, you also may want to open one of the project's files in Visual Studio and save it as UTF-8, to get it out of the Unicode "rut". 

mark0978

  • Community Member
  • Posts: 98
  • Hero Points: -2
Re: Can't view HEX in XML mode?
« Reply #2 on: March 22, 2010, 04:20:47 pm »
I guess I'm still curious why I can't view it in HEX mode though.

od -x will do it, but search/scroll is tough in a little tool like that.

Underneath UTF-16 is made of bytes, I don't know why I can't be allowed to see them.

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Can't view HEX in XML mode?
« Reply #3 on: March 22, 2010, 07:43:24 pm »
I'm told that we can display hex for UTF-8 but not for UTF-16. I'm not terribly familar with UTF, so I did a little reading here: http://en.wikipedia.org/wiki/UTF-16/UCS-2. If I'm understanding this article, displaying the hex values for UTF-16 would require a bit more work than just displaying simple hex values. Maybe we'd have to provide a raw mode that just displays the hex for the 16 bits and a decoded mode which breaks them into the two constituent 10-bit values.

I've added a CR for this, but it won't be part of the v15 release.

mark0978

  • Community Member
  • Posts: 98
  • Hero Points: -2
Re: Can't view HEX in XML mode?
« Reply #4 on: March 23, 2010, 02:39:47 pm »
I like the idea of a raw mode, and possibly a mode that displays 4 digit characters, although raw mode to me is far more useful.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1191
  • Hero Points: 115
Re: Can't view HEX in XML mode?
« Reply #5 on: March 23, 2010, 03:39:24 pm »
There is a way to do that now, you need to open the file and explicitly specify encoding to Binary, SBCS/DBCS mode.  SlickEdit doesn't do any translations (UTF-16/32 -> UTF-8) internally or convert any line ending characters when you specify Binary mode.  You can override the encoding on open using the standard Open dialog (not the smart Open tool window) using browse-open command, or you can directly specify it on the command-line with:

edit +lb +ftext filename.xml

Hex mode is available for Binary encoding, and should be a direct view of the file as it is on disk.

mark0978

  • Community Member
  • Posts: 98
  • Hero Points: -2
Re: Can't view HEX in XML mode?
« Reply #6 on: March 23, 2010, 03:40:18 pm »
That may be sufficient then.