Opened 12 years ago
Closed 12 years ago
#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:1 by , 12 years ago
comment:2 by , 12 years ago
FileGetEncoding shows 0
Windows Notepad shows Unicode and Notepad2 shows Unicode (UTF-16 LE).
The file: http://rghost.net/57508534
comment:3 by , 12 years ago
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 , 12 years ago
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 , 12 years ago
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 , 12 years ago
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 , 12 years ago
| Resolution: | → Fixed |
|---|---|
| Status: | new → closed |

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