Modify

Opened 11 years ago

Closed 11 years ago

#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 Changed 11 years ago by PsaltyDS

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 Changed 11 years ago by Jpm

  • Milestone set to 3.3.7.0
  • Owner changed from Gary to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [5960] in version: 3.3.7.0

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.