Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
June 18, 2013, 08:04:57 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Editing script with Notepad  (Read 6654 times)
WindHydra
JkDefrag Hero
*****
Posts: 69


View Profile
« on: February 21, 2009, 04:46:12 am »

Not sure which forum to post  Roll Eyes

When saving script with Notepad, it adds something to the very beginning of the file ("ff fe" when viewed with hex editor) which causes mydefrag to say "Lexical error at line 1 column 1. Unkown symbol." and exits.  Script works after removing the "ff fe".
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7156



View Profile WWW
« Reply #1 on: February 21, 2009, 08:15:30 am »

Thanks for testing, I appreciate it! MyDefrag scripts are Unicode text files. Try to "save as" with "encoding" set to "Unicode". I think you have saved as "UTF8".
Logged
WindHydra
JkDefrag Hero
*****
Posts: 69


View Profile
« Reply #2 on: February 21, 2009, 08:51:35 am »

I saved with Unicode, and the file works after removing the "ff fe" added by notepad.  Tried saving with utf8 and the file begins with "ef bb bf" and still won't work after removing it.

I used WinXP's notepad to edit the script, then opened in Notepad++ with Hex editor plugin to delete the beginning of the file, which seems to specify what encoding the file was saved in.
Logged
jonib
JkDefrag Hero
*****
Posts: 810


View Profile
« Reply #3 on: February 21, 2009, 09:37:27 am »

Jerome, why did you choose only unicode for your scripts?, it seems as a bit of an unnecessary thing to think about when creating a new script or using tools to create scripts, many of my tools I know don't at least directly support unicode and I would need to convert to unicode as an extra step.
Unicode seems a bit of a overkill for simple scripts.

Just wondering.

jonib
Logged

jeroen
Administrator
JkDefrag Hero
*****
Posts: 7156



View Profile WWW
« Reply #4 on: February 21, 2009, 10:04:14 am »

I saved with Unicode, and the file works after removing the "ff fe" added by notepad.
I wonder what you did exactly to get the "ff fe" characters there in the first place. They have something to do with Unicode and utf-8 and stuff. I think you opened the file in one format and then saved in another format. Notepad on Vista automatically detects the file format and everything works fine, but I think NotePad on XP is less smart.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7156



View Profile WWW
« Reply #5 on: February 21, 2009, 10:14:18 am »

Jerome, why did you choose only unicode for your scripts?
Filenames may contain international characters. To select files in a script it is necessary that the script can contain international characters. Unicode is the standard for that.

Quote
many of my tools I know don't at least directly support unicode and I would need to convert to unicode as an extra step.
Unicode has been around for a long time, even Notepad on Win2K supports it. I don't know which tools you are using, perhaps it's time to upgrade.... I foresee a lot of problems with this, so I will take a look. Perhaps I can let MyDefrag also accept scripts in ANSI and UTF8, and automatically convert them.
Logged
jonib
JkDefrag Hero
*****
Posts: 810


View Profile
« Reply #6 on: February 21, 2009, 10:41:19 am »

Filenames may contain international characters. To select files in a script it is necessary that the script can contain international characters. Unicode is the standard for that.
Yes Unicode is not the problem but "Only" Unicode.
Quote
I don't know which tools you are using, perhaps it's time to upgrade....
Well my File manager/Editor FAR manager is not Unicode ready Sad but there is a development version that is, but I'm not sure how stable/usable it is yet. and there is no alternative file manager for me. Grin
Quote
I foresee a lot of problems with this, so I will take a look. Perhaps I can let MyDefrag also accept scripts in ANSI and UTF8, and automatically convert them.
Even Notepad in my WinXP uses ANSI as default when saving, so it would be great if MyDefrag supported ANSI and UTF8 too.

jonib
« Last Edit: February 21, 2009, 10:46:30 am by jonib » Logged

Lexar
JkDefrag Hero
*****
Posts: 91


View Profile
« Reply #7 on: February 21, 2009, 11:16:03 am »

When you edit a file with notepad.exe and save it in unicode, notepad.exe, for some reason I don't know, places 0xFF and 0xFE at the beginning of the file. It is those two bytes that causes an error. Remove the first two bytes, and you will probably see MyDefrag.exe work all fine.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7156



View Profile WWW
« Reply #8 on: February 21, 2009, 11:23:18 am »

Well my File manager/Editor FAR manager
Perhaps a tip: for a long list of file managers see the Comparison of file managers on Wikipedia. Personally I use Total Commander.
Logged
jonib
JkDefrag Hero
*****
Posts: 810


View Profile
« Reply #9 on: February 21, 2009, 11:37:53 am »

Perhaps a tip: for a long list of file managers see the Comparison of file managers on Wikipedia. Personally I use Total Commander.
I prefer Text mode(console) and I don't know any other modern text mode File manager other then Midnight Commander, that supports plugins, but I'll check your list, thanks for the link.

jonib
Logged

tonne
JkDefrag Hero
*****
Posts: 55


View Profile
« Reply #10 on: February 22, 2009, 12:02:53 am »

This suggest that notepad only support unicode with BOM:
http://blogs.msdn.com/oldnewthing/archive/2004/03/24/95235.aspx
Logged
boco
JkDefrag Hero
*****
Posts: 153



View Profile
« Reply #11 on: February 22, 2009, 12:29:53 am »

Yeah that's byte order mark (BOM).

http://en.wikipedia.org/wiki/Byte-order_mark

jeroen, maybe you could just ignore these character sequences if they are there and at the start of the file.
Logged

T  hi s    Sign  a tu  re   is  q   uit  e   sor   te d  -op tim i zed  b  y desi  gn   .
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7156



View Profile WWW
« Reply #12 on: February 22, 2009, 08:15:56 am »

jeroen, maybe you could just ignore these character sequences if they are there and at the start of the file.
Thanks for your suggestion. The next beta will accept scripts in Unicode, UTF-8, and ANSI. The last 2 are automatically translated internally into Unicode.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!