Modify

#1805 closed Bug (Fixed)

Functions that modify files should not change encoding

Reported by: PsaltyDS Owned by: Jpm
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 PsaltyDS, on Nov 9, 2010 at 6:18:12 PM

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.

comment:2 by Jpm, on Dec 9, 2010 at 11:21:13 PM

Milestone: 3.3.7.0
Owner: changed from Gary to Jpm
Resolution: Fixed
Status: newclosed

Fixed by revision [5960] in version: 3.3.7.0

Modify Ticket

Action
as closed The owner will remain Jpm.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.