這年頭還在用 Bug5 (Big5) 編碼提供資料的網站都該下十八層地獄
以下只能正確讀取 Bug5 編碼的網頁,不是 Bug5 to UTF-8 轉換編碼
$URL = 'Somewhere in hell';
$BIG5 = [System.Text.Encoding]::GetEncoding(950)
$UTF8 = [System.Text.Encoding]::GetEncoding(65001)
$ISO88591 = [System.Text.Encoding]::GetEncoding(28591) #ISO 8859-1 ,Latin-1
[System.IO.File]::WriteAllText(('C:\Temp\SomeData.txt'), ($BIG5.GetString(([System.Text.Encoding]::Convert($UTF8,$ISO88591,($UTF8.GetBytes((Invoke-RestMethod -Uri $URL))))))), $BIG5);