When using copyToClipboard to copy a string that contains non-ASCII characters, the copied text doesn't match the actual string.
For example:
copyToClipboard "привет! 元気" gives:
привет! 元気
when pasted using ctrl+V.
However, if copyFromClipboard is used to paste the code, it works correctly.
I'm not sure if this helps, but converting the string to array (toArray) works and can be used as a workaround to copy the text (although it is encoded in UTF-16, and needs to be decoded using an external program):
_chars = ["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"]; _fnc_getHex = { _code = "\u"; for "_i" from 3 to 0 step -1 do { _quo = floor(_this/16^_i); _code = _code + _chars#_quo; _this = _this - _quo*16^_i; }; _code }; copyToClipboard (toArray "привет" apply {_x call _fnc_getHex} joinString "")