Page MenuHomeFeedback Tracker

[Bug] copyToClipboard doesn't work with non-ASCII characters
Closed, ResolvedPublic


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;

copyToClipboard (toArray "привет" apply {_x call _fnc_getHex} joinString "")


Operating System
Windows 7

Event Timeline

Leopard20 created this task.Oct 4 2020, 8:43 PM
Leopard20 updated the task description. (Show Details)Oct 4 2020, 8:47 PM
BIS_fnc_KK changed the task status from New to Assigned.
This comment was removed by BIS_fnc_KK.
Leopard20 renamed this task from [Bug] copyToClipboard doesn't work with non-latin characters to [Bug] copyToClipboard doesn't work with non-ASCII characters.Oct 7 2020, 2:11 PM
Leopard20 updated the task description. (Show Details)
R3vo added a subscriber: R3vo.EditedNov 16 2020, 9:32 AM

Fixed with

forceUnicode 0; copyToClipboard "привет! 元気";
LouMontana closed this task as Resolved.Nov 16 2020, 9:43 AM