write special character

Help with writing and running scripts

write special character

Postby mpusa » Wed Apr 04, 2007 6:49 am

Hi

I tried the new scritps for the first time.
I made a script that should add the character em-dash (hex 97) to the document. This is the line:

UltraEdit.activeDocument.write("—");
User avatar
mpusa
Newbie
 
Posts: 3
Joined: Tue Apr 03, 2007 11:00 pm

Re: write special character

Postby Jaretin » Wed Apr 04, 2007 7:09 am

I tried this script and it works.

Code: Select all
UltraEdit.insertMode();
UltraEdit.hexOff;
UltraEdit.ueReOn();

UltraEdit.activeDocument.write("—");
User avatar
Jaretin
Basic User
Basic User
 
Posts: 19
Joined: Sun Mar 25, 2007 11:00 pm

Re: write special character

Postby Mofi » Wed Apr 04, 2007 7:16 am

Have you installed latest hotfix v13.00+4?

By the way: If you modify a HTML file you should use the HTML entity as recommended by the HTML standard. If you use HTMLTidy to check your HTML code you will get a warning when simply inserting a — as character and not correctly encoded. The entity is —.

Read also carefully my post at script files can't be utf-8? and the pages referenced there.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4066
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: write special character

Postby mpusa » Wed Apr 04, 2007 7:23 am

Hi

Actually the one line code also works, but the activeDocument obviously has to be UTF-8. I had it in ASCII.

Which is funny, because apparently you can not have the script file in unicode
User avatar
mpusa
Newbie
 
Posts: 3
Joined: Tue Apr 03, 2007 11:00 pm


Return to Scripts