UltraEdit.clipboardContent not supporting Chinese characters?

Help with writing and running scripts

UltraEdit.clipboardContent not supporting Chinese characters?

Postby mloadstar » Sat Mar 26, 2011 12:16 am

If the content is consisting of only ASCII characters, everything is ok:

Code: Select all
UltraEdit.clipboardContent = "hello, world";
UltraEdit.activeDocument.paste();

But if the content contains Chinese characters like

Code: Select all
UltraEdit.clipboardContent = "你好";
UltraEdit.activeDocument.paste();

then I get nothing. Has anyone an idea why?

My version: UEStudio 09.30.0.1002
mloadstar
Newbie
 
Posts: 1
Joined: Sat Mar 26, 2011 12:03 am

Re: UltraEdit.clipboardContent not supporting Chinese characters?

Postby Mofi » Sat Mar 26, 2011 3:10 pm

To create a script file with the 2 lines you posted, it is necessary to use Unicode encoding for the Javascript file itself. But the Javascript interpreter does not support Unicode encoded files. Therefore running a Unicode encoded script with those 2 lines results in error message

An error occurred on line 1:

Script failed.


displayed in the output window which must be manually opened. The Javascript interpreter embedded in UltraEdit supports only ASCII/ANSI files, no Unicode encoded files including UTF-8 encoding. According to Javascript documentations Unicode strings can be defined with 2 different methods:

var sUnicodeText1 = String.fromCharCode(0x4F60,0x597D);
var sUnicodeText2 = "\u4F60\u597D";


But I don't know if that works in UltraEdit. Javascript and also the UltraEdit script functions are mainly designed for working with single byte text strings and not for working with Unicode strings. Working with Unicode strings in Javascript is beyond my knowledge about Javascript.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4062
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Scripts