forceUnicode: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Add Leopard20's because he wanted it to be specifically inserted on this page and nothing could remove that idea from his mind therefore I had to comply so the wiki can be at peace and its Discord channel too - also, I like trains)
m (Add Leopard20's example)
Line 35: Line 35:
[[forceUnicode]] 1;
[[forceUnicode]] 1;
[[copyToClipboard]] "д"; {{cc|Copies "д" to clipboard}}</code>
[[copyToClipboard]] "д"; {{cc|Copies "д" to clipboard}}</code>
|x2= <code>[[private]] _string [[a = b|=]] "привет"; {{cc|a string that uses unicode characters}}
[[systemChat]] [[str]] [[count]] _string; {{cc|12 - the character count is wrong without forceUnicode}}
[[call]] {
[[systemChat]] [[str]] [[count]] _string; {{cc|12 - identical result}}
[[forceUnicode]] 0;
[[systemChat]] [[str]] [[count]] _string; {{cc|6 - correct result}}
};
[[systemChat]] [[str]] [[count]] _string; {{cc|6 - outer scope is affected by forceUnicode as well}}</code>


|seealso= [[copyToClipboard]], [[copyFromClipboard]], [[select]], [[count]], [[in]], [[insert]], [[find]], [[splitString]] [[reverse]]
|seealso= [[copyToClipboard]], [[copyFromClipboard]], [[select]], [[count]], [[in]], [[insert]], [[find]], [[splitString]] [[reverse]]
}}
}}

Revision as of 22:57, 25 February 2021

Hover & click on the images for description

Description

Description:
Switches the mode of operation of the following commands to unicode:
forceUnicode usage with the argument 0 will also apply to called code.
Groups:
Strings

Syntax

Syntax:
forceUnicode mode
Parameters:
mode: Number - Mode of operation, can be:
  • -1 - off
  •  0 - on until end of script
  •  1 - on until next compatible command
Return Value:
Anything

Examples

Example 1:
copyToClipboard "д"; // Copies "д" to clipboard forceUnicode 1; copyToClipboard "д"; // Copies "д" to clipboard
Example 2:
private _string = "привет"; // a string that uses unicode characters systemChat str count _string; // 12 - the character count is wrong without forceUnicode call { systemChat str count _string; // 12 - identical result forceUnicode 0; systemChat str count _string; // 6 - correct result }; systemChat str count _string; // 6 - outer scope is affected by forceUnicode as well

Additional Information

See also:
copyToClipboardcopyFromClipboardselectcountininsertfindsplitString reverse

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note