Hi
I got the some same problem with UTF8 files and ReplaceStringInFile
I figure the same solution about the code replacement
$hWriteHandle = FileOpen($szFileName, 128 + 2)
As i work only in UTF8 or ANSI, i choose to copy/paste the _ReplaceStringInFile function to create a new _ReplaceStringInUTF8File function and change the
$hWriteHandle = FileOpen($szFileName, 2)To $hWriteHandle = FileOpen($szFileName, 128 + 2)
After many test, i nerver seen it corrupt the file or the string.
P.