From 4c5c1e1e4b312d82396b65852d2508fc1cc41691 Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 10 Jun 2019 09:02:32 -0500 Subject: [PATCH] Properly decode download requests as UTF-8. --- lib/PoEScripts_Download.ahk | 4 ++-- resources/ahk/POE-ItemInfo.ahk | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PoEScripts_Download.ahk b/lib/PoEScripts_Download.ahk index 07b63296..8c44aec1 100644 --- a/lib/PoEScripts_Download.ahk +++ b/lib/PoEScripts_Download.ahk @@ -132,7 +132,7 @@ commandHdr .= "--connect-timeout " timeout " --max-time " timeout + 15 " " } ; get data - html := StdOutStream(curl """" url """" commandData) + html := StdOutStream(curl """" url """" commandData,,"UTF-8") ;html := ReadConsoleOutputFromFile(curl """" url """" commandData, "commandData") ; alternative function @@ -147,7 +147,7 @@ } Else { commandHdr := curl """" url """" commandHdr } - ioHdr := StdOutStream(commandHdr) + ioHdr := StdOutStream(commandHdr,,"UTF-8") ;ioHrd := ReadConsoleOutputFromFile(commandHdr, "commandHdr") ; alternative function } Else If (skipRetHeaders) { commandHdr := curl """" url """" commandHdr diff --git a/resources/ahk/POE-ItemInfo.ahk b/resources/ahk/POE-ItemInfo.ahk index c79a0f7d..3b02d64e 100644 --- a/resources/ahk/POE-ItemInfo.ahk +++ b/resources/ahk/POE-ItemInfo.ahk @@ -10416,7 +10416,7 @@ RemoveConfig(config = "config.ini") FileDelete, %userDirectory%\%config% } -StdOutStream(sCmd, Callback = "") { +StdOutStream(sCmd, Callback = "", encoding = "CP850") { /* Runs commands in a hidden cmdlet window and returns the output. */ @@ -10469,7 +10469,7 @@ StdOutStream(sCmd, Callback = "") { While DllCall( "ReadFile", UInt,hPipeRead, UInt,&Buffer, UInt,4094, UIntP,nSz, Int,0 ) { tOutput := ( AIC && NumPut( 0, Buffer, nSz, "Char" ) && VarSetCapacity( Buffer,-1 ) ) - ? Buffer : %StrGet%( &Buffer, nSz, "CP850" ) + ? Buffer : %StrGet%( &Buffer, nSz, encoding ) Isfunc( Callback ) ? %Callback%( tOutput, A_Index ) : sOutput .= tOutput }