Tapatalk

Script files can't be UTF-8?

Script files can't be UTF-8?

1
NewbieNewbie
1

    Apr 01, 2007#1

    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

    48
    Basic UserBasic User
    48

      Apr 01, 2007#2

      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.

      6,685587
      Grand MasterGrand Master
      6,685587

        Apr 01, 2007#3

        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 Tags & Autocomplete files page.

        Update: Take a look on Creating a Perl regular expression string with ANSI/Unicode characters with lots of details about usage of UTF-8 encoded UE/UES scripts.