script files can't be utf-8?

Help with writing and running scripts

script files can't be utf-8?

Postby ackphht » Sun Apr 01, 2007 3:44 am

I've noticed what may be a couple of bugs with the scripting (and one of them happens with the macros also).

The first is that whenever I try to run a script file that was saved as UTF-8 or UTF-16, I get an error message that there is a problem with the script on line 1. Save it as ANSI, no more error. When it's UTF-16, the error message even lists the UTF-16 BOM.

The second is that I'm trying to insert some non-ASCII characters (fancy quotes, é, á, etc) using findReplace, but instead of the characters, I get question marks. This one also happens with the macros. In fact, I had a macro to do this that used to work, and stopped working when I upgraded to v13, so I thought I'd try the scripting, but it happens there also. (I should mention that I also upgraded to Vista at the same time I upgraded to v13, so maybe it's related to Vista, but I'd think it should still work.)

thanks,
michael
User avatar
ackphht
Newbie
 
Posts: 1
Joined: Sun Dec 18, 2005 12:00 am

Re: script files can't be utf-8?

Postby Inray » Sun Apr 01, 2007 6:01 am

ackphht wrote:I should mention that I also upgraded to Vista at the same time I upgraded to v13, so maybe it's related to Vista, but I'd think it should still work.


Hmm, it seems that you've just discovered one more bug of Ultraedit's utf-8 implementation. BTW it is not related to Vista, same problem exists on XP too.
User avatar
Inray
Advanced User
Advanced User
 
Posts: 52
Joined: Wed Jul 14, 2004 11:00 pm
Location: Europe

Re: script files can't be utf-8?

Postby Mofi » Sun Apr 01, 2007 11:57 am

My experience with JavaScript and their engines is very poor. But I think they don't like Unicode and UTF-8 works only when the UTF-8 characters are inside a string and the UTF-8 script does not have a BOM.

Do you know that UE/UES uses the core of the Mozilla JavaScript engine?

After a quick look on Core JavaScript 1.5 Guide:Unicode I think you can use only ASCII escaped Unicode.

And I hope you have installed latest hotfix, because in history for hotfix 2 there was the line:

Issue with extended ASCII characters in the script method write() fixed

Extended ASCII characters are the ANSI characters above 127.

Note: Bug reports without exact version information are useless!

Last I hope you know that there are HTML entities for the characters you have listed. Open the tag list view of UE v13, select tag group "HTML - Special Characters" and look. This list is from Character entity references in HTML 4. A tag list file with all HTML 4 entities on this page can be downloaded from the Additional Downloads page.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Scripts