© J.C. Kessels 2009
MyDefrag Forum
June 18, 2013, 08:04:57 am
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
:
Home
Help
Search
Login
Register
MyDefrag Forum
>
MyDefrag v4 Forum
>
Requests for new features
>
Editing script with Notepad
Pages: [
1
]
« previous
next »
Print
Author
Topic: Editing script with Notepad (Read 6654 times)
WindHydra
JkDefrag Hero
Posts: 69
Editing script with Notepad
«
on:
February 21, 2009, 04:46:12 am »
Not sure which forum to post
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
Re: Editing script with Notepad
«
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
Re: Editing script with Notepad
«
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
Re: Editing script with Notepad
«
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
MyDefrag script syntax highlighting generator
.
jeroen
Administrator
JkDefrag Hero
Posts: 7156
Re: Editing script with Notepad
«
Reply #4 on:
February 21, 2009, 10:04:14 am »
Quote from: WindHydra on February 21, 2009, 08:51:35 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
Re: Editing script with Notepad
«
Reply #5 on:
February 21, 2009, 10:14:18 am »
Quote from: jonib on February 21, 2009, 09:37:27 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
Re: Editing script with Notepad
«
Reply #6 on:
February 21, 2009, 10:41:19 am »
Quote from: jeroen on February 21, 2009, 10:14:18 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
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.
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
MyDefrag script syntax highlighting generator
.
Lexar
JkDefrag Hero
Posts: 91
Re: Editing script with Notepad
«
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
Re: Editing script with Notepad
«
Reply #8 on:
February 21, 2009, 11:23:18 am »
Quote from: jonib on February 21, 2009, 10:41:19 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
Re: Editing script with Notepad
«
Reply #9 on:
February 21, 2009, 11:37:53 am »
Quote from: jeroen on February 21, 2009, 11:23:18 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
MyDefrag script syntax highlighting generator
.
tonne
JkDefrag Hero
Posts: 55
Re: Editing script with Notepad
«
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
Re: Editing script with Notepad
«
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
Re: Editing script with Notepad
«
Reply #12 on:
February 22, 2009, 08:15:56 am »
Quote from: boco on February 22, 2009, 12:29:53 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
« previous
next »
Jump to:
Please select a destination:
-----------------------------
MyDefrag v4 Forum
-----------------------------
=> Announcements
=> Questions and help
=> Bugs and problems
=> Requests for new features
=> Scripts, and other contributions
-----------------------------
JkDefrag v3 Forum
-----------------------------
=> Announcements
=> Questions and help
=> Bugs and problems
=> Requests for new features
=> Programming with the library
Loading...