{"name":"forceUnicode","operator":null,"title":"forceUnicode","type":"command","url":"https://community.bistudio.com/wiki/forceUnicode","revid":377708,"updated":"2026-01-02T09:03:46Z","groups":["Strings"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.02"}],"since":{"game":"arma3","name":"Arma 3","version":"2.02"},"arma3_since":"2.02","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"List of the commands that work with forceUnicode\n- copyFromClipboard\n- copyToClipboard\n- count\n- find\n- in\n- insert\n- reverse\n- select\n- splitString\n- trim\n- regexFind\n- regexMatch\n- regexReplace\n\nSets the Unicode flag which forces some of the string manipulation commands to switch to <https://en.wikipedia.org/wiki/Unicode>.\nThe Unicode flag is always set right after forceUnicode command execution, but is reset depending on the command mode (see *mode*).\n\nWhen the flag is set it will also affect all scopes within the script including child scopes (see diag_scope).\nThere are many other string manipulation commands like ctrlSetText, getTextWidth, etc. that support Unicode by design so no additional forcing is needed.","syntaxes":[{"syntax":"forceUnicode mode","since":null,"effect":null,"exec":null,"params":[{"name":"mode","type":"Number","optional":false,"default":null,"description":"mode of operation, can be:\n- -1 - resets previously set Unicode flag\n-  0 - sets Unicode flag until the end of script\n-  1 - sets Unicode flag until after next supported command or until the end of script, whichever comes earlier","types":["Number"],"since":null,"text":"mode: Number - mode of operation, can be:\n- -1 - resets previously set Unicode flag\n-  0 - sets Unicode flag until the end of script\n-  1 - sets Unicode flag until after next supported command or until the end of script, whichever comes earlier"}],"returns":{"type":"Anything","types":["Anything"],"description":null,"text":"Anything"},"form":"unary","operator":null,"left":null,"right":{"text":"mode","types":["Number"]}}],"examples":[{"text":"```sqf\ncopyToClipboard \"д\"; // copies \"Ð´\" to clipboard\nforceUnicode 1;\ncopyToClipboard \"д\"; // copies \"д\" to clipboard\n```","code":["copyToClipboard \"д\"; // copies \"Ð´\" to clipboard\nforceUnicode 1;\ncopyToClipboard \"д\"; // copies \"д\" to clipboard"]},{"text":"```sqf\nprivate _string = \"привет\";            // a string that uses Unicode characters\nsystemChat str count _string;        // 12 - the character count is wrong without forceUnicode\n\ncall {\n    systemChat str count _string;    // 12 - identical result\n    forceUnicode 0;\n    systemChat str count _string;    // 6 - correct result\n};\n\nsystemChat str count _string;        // 6 - outer scope is affected by forceUnicode as well, because the command mode is 0\n\nforceUnicode -1; // cancelled\n\ncall {\n    systemChat str count _string;    // 12 - wrong count\n    forceUnicode 1;\n    systemChat str count _string;    // 6 - correct result, but Unicode it reset after this operation, because command mode is 1\n};\n\nsystemChat str count _string;        // 12 - outer scope is not affected as it was reset right after count\n```","code":["private _string = \"привет\";\t\t\t// a string that uses Unicode characters\nsystemChat str count _string;\t\t// 12 - the character count is wrong without forceUnicode\n\ncall {\n\tsystemChat str count _string;\t// 12 - identical result\n\tforceUnicode 0;\n\tsystemChat str count _string;\t// 6 - correct result\n};\n\nsystemChat str count _string;\t\t// 6 - outer scope is affected by forceUnicode as well, because the command mode is 0\n\nforceUnicode -1; // cancelled\n\ncall {\n\tsystemChat str count _string;\t// 12 - wrong count\n\tforceUnicode 1;\n\tsystemChat str count _string;\t// 6 - correct result, but Unicode it reset after this operation, because command mode is 1\n};\n\nsystemChat str count _string;\t\t// 12 - outer scope is not affected as it was reset right after count"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["copyToClipboard","copyFromClipboard","select","count","in","insert","find","splitString","reverse"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Strings","Introduced with Arma 3 version 2.02","Scripting Commands"]}