Skip to content

Instantly share code, notes, and snippets.

@ariel-co
Created May 12, 2024 01:49
Show Gist options
  • Select an option

  • Save ariel-co/d1eb1ee895cae204194c5b504af42fed to your computer and use it in GitHub Desktop.

Select an option

Save ariel-co/d1eb1ee895cae204194c5b504af42fed to your computer and use it in GitHub Desktop.
how strings get garbled by wrong encodings
[System.Text.Encoding]::UTF8.GetBytes("é") | % ToString X2 | Join-String -Separator " "
# C3 A9
[System.Text.Encoding]::Latin1.GetBytes("é") | % ToString X2 | Join-String -Separator " "
# E9
[System.Text.Encoding]::Latin1.GetString( [System.Text.Encoding]::UTF8.GetBytes("é") )
# é
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment