| 1 | #cs ---------------------------------------------------------------------------- |
|---|
| 2 | |
|---|
| 3 | AutoIt Version: 3.3.16.0 |
|---|
| 4 | Author: myName |
|---|
| 5 | |
|---|
| 6 | Script Function: |
|---|
| 7 | Template AutoIt script. |
|---|
| 8 | |
|---|
| 9 | #ce ---------------------------------------------------------------------------- |
|---|
| 10 | |
|---|
| 11 | ; Script Start - Add your code below here |
|---|
| 12 | |
|---|
| 13 | ; Bug in BinaryToString with single non-ANSI character |
|---|
| 14 | $single_r_hacek = 0x99C5 ; LE UTF-code C599 for ř U+0159 LATIN SMALL LETTER R WITH CARON, NOT in ANSI |
|---|
| 15 | $UTF8_single_r_hacek = BinaryToString($single_r_hacek, 4) ; convert to UTF-8 string |
|---|
| 16 | ConsoleWrite(StringLen($UTF8_single_r_hacek)) ; gives WRONG output 3 instead of 1 |
|---|
| 17 | MsgBox(0, "", $UTF8_single_r_hacek) ; correct ř output |
|---|
| 18 | FileWrite("single_test.txt", $UTF8_single_r_hacek) ; WRONG 0xC5990000 in file |
|---|
| 19 | $binfile = FileOpen("single_test_bin.txt", 16 + 2) |
|---|
| 20 | FileWrite($binfile, $UTF8_single_r_hacek) ; WRONG 0x720000 in binary file (ANSI/ASCII r) |
|---|
| 21 | FileClose($binfile) |
|---|
| 22 | |
|---|
| 23 | $double_r_hacek = 0x99C599C5 |
|---|
| 24 | $UTF8_double_r_hacek = BinaryToString($double_r_hacek, 4) ; convert to UTF-8 string |
|---|
| 25 | ConsoleWrite(StringLen($UTF8_double_r_hacek)) ; gives correct output 2 |
|---|
| 26 | MsgBox(0, "", $UTF8_double_r_hacek) ; correct řř output |
|---|
| 27 | FileWrite("double_test.txt", $UTF8_double_r_hacek) ; correct 0xC599C599 in file |
|---|
| 28 | $binfile = FileOpen("double_test_bin.txt", 16 + 2) |
|---|
| 29 | FileWrite($binfile, $UTF8_double_r_hacek) ; WRONG 0x7272 in binary file |
|---|
| 30 | FileClose($binfile) |
|---|
| 31 | |
|---|