e.g.:
- Code: Select all
UltraEdit.clipboardContent = "Hello\0world\n";
UltraEdit.activeDocument.paste();
Result: Hello
Fix that plz!
Welcome to the IDM Forum. This forum is meant as a user-to-user support mechanism where users can share knowledge and tips for all IDM software.
Since these forums are user-to-user based, IDM does not regularly read or reply to the posts in this forum. For problem reports, suggestions, or feature requests, you must email us directly. Our trained technical support staff answers most inquiries within 30 minutes.
UltraEdit.clipboardContent = "Hello\0world\n";
UltraEdit.activeDocument.paste();

pietzcker wrote:Hi, this is a user-to-user forum. You probably want to read what's written on top of every page here
Mofi wrote:NULLs are not possible because the Javascript core engine handles strings as NULL terminated character array. So every NULL byte in a character array is automatically the end of the string. IDM can't change this and of course in text files NULL bytes should be never used or present.
UltraEdit.activeDocument.paste();
UltraEdit.clipboardContent = UltraEdit.clipboardContent;
UltraEdit.activeDocument.paste();<script type="text/javascript">
var Text1="zero\0zero";
alert("Text 1 is: "+Text1);
alert("Text 1 length is: "+String(Text1.length));
var Text2 = "Text is: "+Text1+" and text length is: "+String(Text1.length);
alert(Text2);
alert("Text 2 length is: "+String(Text2.length));
</script>
Mofi wrote:But array property length is not equal the string length for your example.
<script type="text/javascript">
var Text1="one\0two";
alert("Text 1 is: "+Text1);
alert("Text 1 starting from 4-th char is: "+Text1.substr(4));
</script>Mofi wrote:UltraEdit.clipboardContent = UltraEdit.clipboardContent;
I'm not wondering that this clears the clipboard content because the clipboard is a dynamically allocated memory buffer using malloc() and free() in 'C' or new and delete in C++ (which uses in the background also malloc() and free()). So when you assign (=copy) a buffer to the clipboard, the first function called is free() to release the existing memory buffer of the (active) clipboard.
Mofi wrote:The problem is that UltraEdit stops character copying from the clipboard buffer to the file buffer in text mode on first ocurrence of a NULL byte which is in my point of view a correct behavior because NULL bytes are binary bytes and should not exist in a text file (except in UTF-16 files).
var str;
str = "test";
UltraEdit.clipboardContent = "test";
UltraEdit.activeDocument.write(str.length+";"+UltraEdit.clipboardContent.length+"\n");
str = "test\0with NULL byte";
UltraEdit.clipboardContent = "test\0with NULL byte";
UltraEdit.activeDocument.write(str.length+";"+UltraEdit.clipboardContent.length+"\n");999999 wrote:Actually, the first alert prints different text on different browsers. IE and Opera print "one", while Firefox and Chrome print "onetwo". That's because the alert function works in different manner on these browsers, that's all. Javascript have all the data, and the second alert can prove that.
999999 wrote:That's not related to the topic. C and Javascript have different rules, although they have a similar syntax.
999999 wrote:Which proves that the behavior of UltraEdit.clipboardContent is not a correct behavior of a Javascript string, and (first post again) - "UltraEdit.clipboardContent won't accept NULL char"

Mofi wrote:Yes, that's what I wanted to explain. The array contains all bytes, but how the bytes are interpreted on read depends on the interpreting functions. In C/C++ a NULL terminated string (not a Unicode string) is always printed from first byte to the first occurrence of a byte with value 0. ... Unicode string arrays contain an extra length property which is used also for printing Unicode strings.
999999 wrote:But I guess the priority to look into this issue is very low for IDM because who really needs to use the clipboard with strings including NULL bytes with that method?
UltraEdit.ueReOn();
UltraEdit.activeDocument.hexOn(); // Turn on hex edit mode.
UltraEdit.activeDocument.top(); // Set cursor to top of the file.
UltraEdit.activeDocument.findReplace.searchAscii=false; // Run replace with hexadecimal values.
UltraEdit.activeDocument.findReplace.matchCase=false;
UltraEdit.activeDocument.findReplace.searchDown=true;
UltraEdit.activeDocument.findReplace.replaceAll=true; // Replace all occurrences in the current file.
UltraEdit.activeDocument.findReplace.regExp=false;
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.replace("23213F", "00"); // Replace all #!? with a NULL byte.
UltraEdit.activeDocument.paste(); // works
UltraEdit.clipboardContent = UltraEdit.clipboardContent;
UltraEdit.activeDocument.paste(); // works
UltraEdit.clipboardContent = "\xFF";
UltraEdit.activeDocument.paste(); // pastes 0x79
UltraEdit.clipboardContent = String.fromCharCode(0xFF);
UltraEdit.activeDocument.paste(); // pastes 0x79
999999 wrote:OK, great, I've just found out that UltraEdit won't paste binary data at all, if it was assigned in the script
...

