Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly decode download requests as UTF-8. #982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/PoEScripts_Download.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions resources/ahk/POE-ItemInfo.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
}
Expand Down