Saving JS script in a Script editor removes unicode symbols and adds NULs

I have a script with an attached dialog ==SCRIPT RESOURCES so I can edit the JS part in a text editor and the resources part in the visual Script editor/dialog editor

But then from time to time when saving Dialog editor edits I get NUL inserted right before ==SCRIPT RESOURCES, and sometimes those nulls multiply :slight_smile:

Haven't noticed any other corruption, so manually removing those nulls in the editor fixes the issue temporarily

Haven't noticed which specific edits cause this

file is utf8 with bom, linefeeds as line endings (is it because of this? DOpus checks for CRs?)

Can you work out what steps are necessary to reproduce it?

I couldn't so far, I thought you might have more ideas since you know how DOpus saves those files

The only other thing I've noticed is that unless I close the dialog editor DOpus doesn't re-read resources even if I close all the tabs with dialogs opened (so if I manually edit a value in the file with all tabs closed and reopen a dialog, it has old values), so maybe it's some caching issue? Though this also doesn't introduce nulls in testing

Found the issue - various symbols like :clock1: in strings confuse Dopus, so it removes them and adds nulls, so it corrupts the main script itself (I was wondering where all my symbols have gone)

For example, this line var width_max = [sC['Max↔ 1🕐'],sC['Max↔ 2🕐']]; becomes var width_max = [sC['Max↔ 1'],sC['Max↔ 2']];

It's not about dialog editor at all (strangely enough, the symbols in XML strings survive), the main JS script save function corrupts

Thanks! Fixed in the next update.

The corruption seems gone, though the line breaks aren't preserved (lf replaced with crlf), could you please also save with the same linebreaks as the original file?

CR/LF is standard for Windows, it seems odd to want something different.

1 Like

which doesn't always play nice with non-win tools, so I've set my editor to use LF even on Windows

By the way, does your xml parser support syntax-preserving mode so I could have a more readable resources view for doing some quick edits within the file without opening the dialog editor (e.g., having columns as columns, not rows, or having all height props be verticall yaligned)?