Modify ↓
Opened 15 years ago
Closed 15 years ago
#1805 closed Bug (Fixed)
Functions that modify files should not change encoding
| Reported by: | PsaltyDS | Owned by: | J-Paul Mesnage |
|---|---|---|---|
| Milestone: | 3.3.7.0 | Component: | Standard UDFs |
| Version: | 3.3.6.1 | Severity: | None |
| Keywords: | Cc: |
Description
Functions like _FileWriteToLine() and _ReplaceStringInFile() should not rewrite the file with default ANSI encoding, since it is trivial to get the old encoding by FileGetEncoding() first.
For example, the FileOpen() for write within _ReplaceStringInFile() should be:
;===============================================================================
;== Open the output file in write mode
;===============================================================================
Local $iEncoding = FileGetEncoding($szFileName)
Local $hWriteHandle = FileOpen($szFileName, $iEncoding + $FO_OVERWRITE)
If $hWriteHandle = -1 Then Return SetError(2, 0, -1)
Attachments (0)
Change History (2)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
| Milestone: | → 3.3.7.0 |
|---|---|
| Owner: | changed from to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [5960] in version: 3.3.7.0
Note:
See TracTickets
for help on using tickets.

Forgot to note where the issue came up, for reference: http://www.autoitscript.com/forum/topic/121931-fileinstall-corrupts-xml-changes-utf-16-encoding FileInstall corrupts XML (changes UTF-16 encoding), by akshaymishra14.