Skip to content

Commit

Permalink
Update Remove-Accents-using-Cyrillic.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey authored Jul 19, 2024
1 parent c6258ef commit bd9486e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion encoding/Remove-Accents-using-Cyrillic.ps1
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
function RemoveAccents {
<#
.synopsis
Strip accents from text using cyrillic encoding. warning: this is a simple method, but does remove non-accented characters that weren't encodable
Strip accents from text using cyrillic encoding
.notes
warning: this is a simple method, but does remove non-accented characters that weren't encodable
it's a single-byte encoding
🐒
#>
param( [string] $Text )
$enc = [Text.Encoding]::GetEncoding('iso-8859-5')
$enc.GetString( $enc.GetBytes( $Text ) )
}

RemoveAccents 'foo bår'
# output: foo bar

RemoveAccents 'foo 🐒 bar'
# output: foo ?? bar

<#
I'm not 100% this is the best cyrillic to use, there's a few
Expand Down

0 comments on commit bd9486e

Please sign in to comment.