DerPensionist

Undocumented functionality change of UDF _HexToString

10 posts in this topic

#1 ·  Posted (edited)

Autoit v3.3.14.1 converts hexstring not only to string but also to UTF8. Conversion to UTF8 is undocumented in helpfile.
This change is in some cases very essential! This should be documented, or much better add an aditional parameter (flag of BinaryToString) to the function.
Up to Autoit v3.3.12.1 worked fine, since v3,3,14.1 give wrong results.
Example:
string: "0xFFD8FFE000104A464946" ......JFIF
v3.3.12.1: FFD8FFE000104A464946 correct
v3.3.14.1: EFBFBDEF0104A464946 confusing ! or with an longer string
long string: 3F3F3F3F0010..... and this is a wrong JPG-file



Edited by DerPensionist
minimal reproducer.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Please post minimal reproducer. I suspect you read or write binary data in text mode or something.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Sorry, I wanted explain the big change. (File written in binary, and has nothing to do with the conversion)

Share this post


Link to post
Share on other sites

Which "big change" are you talking about?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Changes to AutoIt are always documented in the "Change History" or the "Script breaking Changes" .


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I do not believe that everybody has always to check "Check History" and "Script Breaking Changes", but can expect that helpfile has all required information.
Version v3.3.12,1 used internal StringToBinary($sHex) with default flag : $SB_ANSI (1) = binary data is ANSI (default)
in v3.3.14.1 changed to StringToBinary($sHex,$SB_UTF8) (4) = binary data is UTF8

this has signifant changes in result. (all invalid ANSI values changing to 0x3F)

Modified routine seems to work as _HexUFT8ToANSI() wich assumes input UFT8 encoded. I beleave terms of "Hex" and "Binary" are indepent of encoding UTF8/ANSI.
Anyway in older version was $var == _StringToHex(_HexToString($var)) was always tru.
With new release no longer, if string contains any Non-ANSI charachter. HTML input contains somtimes some.



Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I do not believe that everybody has always to check "Check History" and "Script Breaking Changes", but can expect that helpfile has all required information.

Which it has in the script breaking changes... so it is a moot point whether you agree or not and your choice to ignore this but please don't come crying to us.

Agree?

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

To add to what Jos said, just use an old version of AutoIt and then those script breaking changes all go away. As to your comment about people not checking the changelog when upgrading, then bigger fools them. Downloading a new version of AutoIt is entirely voluntary, be we do expect a little bit of common sense before doing so. Now back to our regularly scheduled programming.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

It was bad comunicated by me.
I think it should not be necessary for all beginners to read all "Change History" entries.
The help should have soon or later all information.
And there is no documentation that this function also conversts the hexstring from UTF8 to ANSI.

Edited by DerPensionist
text expanded

Share this post


Link to post
Share on other sites

It was bad comunicated by me.
I think it should not be necessary for all beginners to read all "Change History" entries.
The help should have soon or later all information.
And there is no documentation that this function also conversts the hexstring from UTF8 to ANSI.

I don't think most newbies use hextostring o.0

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

  • Similar Content

    • Myicq
      By Myicq
      a recent post mentioned UTF-8 and encoded strings.

      I have the need to go this way, deliberately. This is to encode Hebrew into a barcode, where the application only supports plain ANSI. Barcode will render correctly with escaped hex values.

      Example:

      $string = "אין כמו הבית" ; "no place like home" in Hebrew. ConsoleWrite( StringToBinary($string,4) & @CRLF ) ; returns ; 0xD790D799D79F20D79BD79ED79520D794D791D799D7AA
      This is close, but I need this in individually encoded chars. Like this:

      \xD7\x90\xD7\x99\xD7\x9F\x20\xD7\x9B\xD7\x9E\xD7\x95\x20\xD7\x94\xD7\x91\xD7\x99\xD7\xAA

      I probably miss something obvious. But is there a function to convert string directly into this output, or something to convert internal hex to escaped format ?