{"name":"forceUnicode","title":"forceUnicode","type":"command","url":"https://community.bistudio.com/wiki/forceUnicode","revid":377708,"updated":"2026-01-02T09:03:46Z","groups":["Strings"],"status":"ok","games":{"arma3":"2.02"},"since":"arma3 2.02","arma3_since":"2.02","description":"List of the commands that work with forceUnicode\n\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 [Unicode](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","params":[{"name":"mode","type":"Number","description":"mode of operation, can be:\n\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","type_expr":"Number"}],"returns":{"type":"Anything","type_expr":"Anything"},"form":"unary","right":{"text":"mode"}}],"examples":[{"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"]}],"see_also":["copyToClipboard","copyFromClipboard","select","count","in","insert","find","splitString","reverse"]}