Author Topic: Encodings and hex view  (Read 2187 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Encodings and hex view
« on: August 03, 2016, 06:57:29 PM »
1. Create a new buffer : Encoding = UTF16
2. Enter some text.
3. Save the file to bug.txt
4. View->Hex.
5. Move down several lines and insert a byte. (See #C below)
6. Save as Bug2.txt: Note this SaveAs dialog doesn't have an Encoding option.

The buffer is now named Bug2, and not in HEX mode.
The encoding is now UTF-8 - so it is all spaced out.

7. Attempting Reload With Encoding: UTF-16 doesn't help.


So it isn't clear what the bug(s) is/are here.


#A: Slick it decides to go to UTF-8 despite user request for UTF-16 because it thinks the file isn't valid UTF-16 - since it is an ODD number of bytes long.
Slick should complain to the user:
     Yo, that file is an odd number of bytes long - so it aint unicode-16.
     Try anyway, or revert to something else (like binary or utf-8)

#B: When doing a SaveAs: Why isn't there an encoding option?

#C: After the SaveAs, why UTF-8?
This happens even when, in step 5 you insert a valid two-byte UTF-16 code.

#D: Why doesn't SLICK put the encoding, line ending information into the status bar at the bottom? (Next to line, col, selection, etc).


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Encodings and hex view
« Reply #1 on: August 03, 2016, 07:39:03 PM »
I can't seem to reproduce step 6.

After I do a SaveAs, the buffer is in hex mode. If it's not, that would be a bug but I can't reproduce it. I created a new buffer with no name with encoding "Utf-16".

Reload with encoding needs to be disabled when in this special state.

A: When you switch to Hex, you're have instructed SlickEdit to view the byte by byte Utf-16 data. You can trash the file when editing. We will have to take a look at the error handling here. It needs to at least let you fix it by making the file an even number of bytes. I'm thinking Binary,SBCS/DBCS is a better choice for viewing a Utf-16 byte data.

B. You're in a very special mode. Have to disable encoding. Need disable "Reload with encoding" too.

C. I think this needs to be Binary, SBCS/DBCS

D. Our todo list is really long. At some point, you just have to push things off. Otherwise, features we have to get done will never get done.  ;D

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Encodings and hex view
« Reply #2 on: August 03, 2016, 09:53:06 PM »
I reproduced the SaveAs bug which takes you out of hex mode. We will fix that too. Thanks for finding it.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Encodings and hex view
« Reply #3 on: August 04, 2016, 12:52:32 AM »
All fixed for beta 3. I also noticed an auto restore issue where it doesn't auto restore hex mode correctly.