Switch off Hex Mode on opening a file

General and specific configuration/INI settings

Switch off Hex Mode on opening a file

Postby Kunzara » Thu May 04, 2006 8:11 am

Hi,

I have a little problem with a protocol file we generate in another program.
There we generate sometimes unprintable characters in case of programming errors and if I understand the help correctly, UE will open these files always in hex mode.

So my question is: Is there any option I can enable to prevent UE from this behavior?

Greetings,

Kunzara
User avatar
Kunzara
Newbie
 
Posts: 1
Joined: Wed May 03, 2006 11:00 pm

Re: Switch off Hex Mode on opening a file

Postby Mofi » Thu May 04, 2006 9:13 am

First enable the option Allow editing of text files with HEX 00's without converting them to spaces at Configuration - Editor - Advanced. If this solves your problem - fine.

But maybe best method would be to create a macro which is executed on every file load which detects protocol files with the invalid bytes lower 0x20, fixes these bytes and last automatically switches to normal mode. Well, you could simple have the command HexOff in this macro.

Note: If you have specified a macro file to be automatically loaded on startup of UE, the macros executed at every file load and/or save must be also in this macro file.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4068
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Switch off Hex Mode on opening a file

Postby GoAWest » Wed Aug 13, 2008 7:48 pm

I'm having the same problem (and just want to turn the HEX open feature off). Can you point me to the right place?

I tried the macro suggestion found here, but it hasn't worked for me.

Thanks,
-A
User avatar
GoAWest
Newbie
 
Posts: 4
Joined: Tue Jul 11, 2006 11:00 pm

Re: Switch off Hex Mode on opening a file

Postby Mofi » Thu Aug 14, 2008 2:15 am

The binary file detection cannot be disabled. Your text files are not text files, they are binary files because they contain surely binary bytes. Upload whole or a part (test this part file too) of one of your files in a ZIP archive which always open in hex edit mode, and I will look into it and tell you why it is opened as binary file and what the program make wrong which creates this "text" file which is not a text file.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4068
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Switch off Hex Mode on opening a file

Postby GoAWest » Thu Aug 14, 2008 1:55 pm

I'm using UE (14.10.0.1024) to open a (text) *.log file being generated by another program (Linux script). The file is on a Linux file server.

The file is continuously updated unless I stop the other task. Sometimes I open it via a double click from Windows; other times I get the "the file has been updated, would you like to refresh/reload?" mesage in UE if it's already open. In any of these these cases, the file time *sometimes* opens/displays cleanly as text and sometimes opens/displays as hex and I have to switch modes. As far as I can tell, the file *always* opens as text if I shut down the other app so that the file is static and only UE is opening it.

It's possible that the issue is that UE may be opening the file in mid-update so that it's seeing odd characters and thinks it's a binary file. Opening, closing, opening, etc. the file multiple times in a row shows the binary, text, text/binary+... behavior.

As you say, there's no way to just turn off hex mode entirely ( :- ). I don't know if one of the macro scripts would allow me to do this (always open *.log files as text-only) but I haven't had luck with this so far.

Notepad has no problems with this file (always text, and NP has no hex mode).
User avatar
GoAWest
Newbie
 
Posts: 4
Joined: Tue Jul 11, 2006 11:00 pm

Re: Switch off Hex Mode on opening a file

Postby Mofi » Sat Aug 16, 2008 11:36 am

Notepad has no hex edit mode, so it must show you the file content always in text mode even when it is a binary file. You can turn off in UltraEdit Disable automatic detection of HEX file format on reload. But if the application on your Linux server writes really only ASCII bytes into the file, UltraEdit should never think the file is a binary file, independent if the Linux application is writing to the file when UltraEdit is reloading it or not. I guess, this is more a problem on data transmission from the Linux server to your computer while the Linux application is writing to the file and UltraEdit reloads it.

Well, UltraEdit analyzes only the first 9 KB (UE v11.20a) or 64 KB (UE v14.00b) of the file if it contains 2 or more NULL bytes. If this is the case, it opens the file in binary mode. Does your Linux application always insert the text data at top of the file or append it at the end?
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4068
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Switch off Hex Mode on opening a file

Postby GoAWest » Mon Aug 18, 2008 7:45 pm

Yes, I'm aware that Notepad doesn't have a Hex mode. I was just pointing out the NP had no problem displaying this file and it was a shame that I had to resort to NP to view the files easily.

I already had "Disable automatic detection of HEX file format on reload." I'm not sure if I want to say it didn't work *or* if I had just gotten in the habit of always opening the file from scratch.

I don't know how the Linux box is writing out the files (it's just a script >> redirecting to a file). I would have assumed it would append them (from the end) but something was confusing UE, even if it was looking for the bin char at the beginning.

I finally played around with the macro setup and seem to have gotten a "run on open" macro that forces text (hex disable) mode for *.log files (the way I'm naming these files from the Linux box). That seems to be working OK.

I still think that UE should include a way to disable the hex mode.

Thanks,
G-
User avatar
GoAWest
Newbie
 
Posts: 4
Joined: Tue Jul 11, 2006 11:00 pm


Return to Configuration/INI Settings