Sign in to follow this  
Followers 0
Krakatoa

FileOpen bug?

3 posts in this topic

Why open file in Autoit 3.3.12.0 as string (OK)

and

why open file in Autoit 3.3.14.0 and 3.3.15.0 as hex (?) (KO).

Help.

Thanks.

$hFile = FileOpen("vs2015.com_enu.iso.torrent")
$sFileRead = FileRead($hFile)
$aArray = StringRegExp($sFileRead, '(^)d8:announce(.*?):http://', 1)
$temp = StringMid($sFileRead, 15, $aArray[1])
MsgBox (0, "", $temp)

Torrent files are different charset (UTF8, UTF8 with bom, ASCII...)

Torrent file:

vs2015.com_enu.iso.torrent

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Script Breaking Changes in Recent Versions

This page contains a list of all changes made in recent updates that will almost certainly break existing scripts. Please read this list carefully when upgrading if you have not been keeping up with developments in the beta versions. If any of these issues affect you then you will need to modify your scripts.

v3.3.14.0

AutoIt:

  • If Min and Max are the same value then Random() will now return that value and the @error flag will no longer be set.
  • Under Vista or Server 2008 _GDIPlus_Startup() need explicit Dll for GDI+ v1.1 support.
  • File operations on text files not opened with FileOpen() and explicit unicode flags now auto-detect encoding slightly differently to be more in line with modern editors. This includes all file functions that are used with a filename, for example FileRead("filename.txt"). Specifically:
    • Files containing a BOM will be opened in the relevant mode as per that BOM. UTF-8 and UTF-16 BOMs are checked.
    • UTF-8 and UTF-16 files without a BOM will be automatically detected and opened in the relevant mode.
    • Files containing nulls are opened in Binary ($FO_BINARY) mode by default (unless they are detected as valid UTF-16). Previously they would be opened in ANSI mode. Use the $FO_ANSI flag to override.
    • Files containing only characters 1-127 are opened in UTF-8 with no BOM ($FO_UTF8_NOBOM) mode by default. Previously they would be opened in ANSI mode. Use the $FO_ANSI flag to override.
    • Files containing only characters 1-255 are opened in ANSI ($FO_ANSI) mode by default.
    • Due to the above FileGetEncoding() now returns 512 ($FO_ANSI) or 256 ($FO_UTF8_NOBOM) instead of 0 which was undocumented but indicated ANSI.
  • New files are written in UTF-8 with no BOM ($FO_UTF8_NOBOM) mode by default. Use FileOpen() to override.
  • UTF-16 files without a BOM are now automatically detected in most cases.

Maybe you want to read the script breaking information from the helpfile first?

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks Jos.

Read changes and use $FO_ANSI and no problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0