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 PsaltyDS, 15 years ago

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 J-Paul Mesnage, 15 years ago

Milestone: 3.3.7.0
Owner: changed from Gary to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [5960] in version: 3.3.7.0

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


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