#2843 closed Bug (Fixed)
_ReplaceStringInFile help file
| Reported by: | ffdshow | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | Documentation | |
| Version: | 3.3.12.0 | Severity: | None |
| Keywords: | Cc: |
Description
Hello,
In the help file, should be written that files encoding in Unicode (UTF-16 LE) can't be edited by _ReplaceStringInFile function.
I succeeded after I recoded the file from Unicode (UTF-16 LE) to ANSI.
Thanks,
ffdshow
Attachments (0)
Change History (8)
comment:2 by , on Aug 16, 2014 at 11:21:21 PM
FileGetEncoding shows 0
Windows Notepad shows Unicode and Notepad2 shows Unicode (UTF-16 LE).
The file: http://rghost.net/57508534
comment:3 by , on Aug 17, 2014 at 12:43:37 PM
I've created a text file, added some characters, then save IT in Unicode (UTF-16 LE) mode using Notepad2. FileGetEncoding shows 0 and _ReplaceStringInFile saved the file in
Unicode (UTF-16 LE BOM). Resulted file is filled with NUL
comment:4 by , on Aug 17, 2014 at 1:50:43 PM
In fact your file does not have BOM.
Jon is thinking to allow such automatic Unicode detection as for now it is not allow as doc is describing it.
comment:5 by , on Aug 17, 2014 at 5:25:37 PM
The current version of AutoIt doesn't support UTF16 files without a BOM. https://www.autoitscript.com/autoit3/docs/intro/unicode.htm
If you load the file in notepad and then save it again you'll notice that it then does get a BOM and works.
I'm currently testing some extra support in an upcoming beta. A preview is at https://www.autoitscript.com/autoit3/files/beta/autoit/AutoIt3_Unicode.exe - that version seems to work with your file.
comment:6 by , on Aug 17, 2014 at 8:13:30 PM
Saving the text file in Windows Notepad will add BOM, but saving in Notepad2 not.
The beta executable work.
Thanks for your support!
ffdshow
comment:8 by , on Aug 19, 2014 at 2:25:41 PM
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |

What does FileGetEncoding() return when applied to your UTF16-LE encoded file? Is it using a BOM or not?