Created
June 30, 2021 19:33
-
-
Save dhmacher/c429a6dfe1cfe3d72e9633cbf05eefe3 to your computer and use it in GitHub Desktop.
Converts an ISO-8859-1 string to UTF-8. Handy on when you receive a response from a web API that does not specify the codepage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/53034595/5471286 | |
function ConvertTo-UTF8 { | |
param( | |
[Parameter(ValueFromPipeline)] [string]$ISOString | |
) | |
return ([Text.Encoding]::UTF8.GetString( ` | |
[Text.Encoding]::GetEncoding(28591).GetBytes($ISOString))) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment