-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Bug] Can not install with url encoded in utf-8
#4911
Comments
@rashil2000 I get the character encoding from the Content-Type header in the response with the help of #4324 (comment). $wc = New-Object Net.Webclient
$wc.Headers.Add('User-Agent', (Get-UserAgent))
$rawData = $wc.downloadData($url)
if($wc.ResponseHeaders["Content-Type"] -match 'charset=([^;]*)') {
$encoding = [System.Text.Encoding]::GetEncoding($Matches[1])
} else {
$encoding = [System.Text.Encoding]::GetEncoding('utf-8')
}
$str = $encoding.GetString($rawData) And I found many May we add a function about it in files that include the utils? Or create a new file to provide this function? |
We can do this |
@rashil2000 I did not find a file that includes common utils. Or did I miss it? |
lib/core.ps1 |
Add Get-Encoding function in core.ps1 close ScoopInstaller#4911
…g ([ScoopInstaller#4956](ScoopInstaller#4956)) Add Get-Encoding function in core.ps1 close ScoopInstaller#4911
…g ([ScoopInstaller#4956](ScoopInstaller#4956)) Add Get-Encoding function in core.ps1 close ScoopInstaller#4911
…ing (ScoopInstaller#4956) Add `Get-Encoding` function in core.ps1 closes: ScoopInstaller#4911 ScoopInstaller#4324 Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
…ing (ScoopInstaller#4956) Add `Get-Encoding` function in core.ps1 closes: ScoopInstaller#4911 ScoopInstaller#4324 Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
Bug Report
Current Behavior
Expected Behavior
The file is encoding with utf-8, but the
Webclient
usedefault
encoding, and it is not recommended.See more in system.net.webclient.encoding and system.text.encoding.default.
Additional context/output
Possible Solution
We can solve this problem by set the
Encoding
forWebclient
.System details
Windows version: [e.g. 7, 8, 10]
win10
OS architecture: [e.g. 32bit, 64bit]
64bit
PowerShell version: [output of
"$($PSVersionTable.PSVersion)"
]5.1.19041.1645
Additional software: [(optional) e.g. ConEmu, Git]
Scoop Configuration
default setting.
The text was updated successfully, but these errors were encountered: