From c6258ef1ae5fdeb8369bde6636932771976797a9 Mon Sep 17 00:00:00 2001 From: Jake Bolton Date: Fri, 19 Jul 2024 11:43:36 -0500 Subject: [PATCH] Create Remove-Accents-using-Cyrillic.ps1 --- encoding/Remove-Accents-using-Cyrillic.ps1 | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 encoding/Remove-Accents-using-Cyrillic.ps1 diff --git a/encoding/Remove-Accents-using-Cyrillic.ps1 b/encoding/Remove-Accents-using-Cyrillic.ps1 new file mode 100644 index 0000000..05d341a --- /dev/null +++ b/encoding/Remove-Accents-using-Cyrillic.ps1 @@ -0,0 +1,30 @@ +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 + #> + param( [string] $Text ) + $enc = [Text.Encoding]::GetEncoding('iso-8859-5') + $enc.GetString( $enc.GetBytes( $Text ) ) +} + +RemoveAccents 'foo bår' + +<# +I'm not 100% this is the best cyrillic to use, there's a few + +Pwsh> [Text.Encoding]::GetEncodings() | ? displayname -Match 'cyr|cry' + +CodePage Name DisplayName +-------- ---- ----------- + 20880 IBM880 IBM EBCDIC (Cyrillic Russian) + 866 cp866 Cyrillic (DOS) + 21866 koi8-u Cyrillic (KOI8-U) + 1251 windows-1251 Cyrillic (Windows) + 10007 x-mac-cyrillic Cyrillic (Mac) + 28595 iso-8859-5 Cyrillic (ISO) + 20866 koi8-r Cyrillic (KOI8-R) + 855 IBM855 OEM Cyrillic + 21025 cp1025 IBM EBCDIC (Cyrillic Serbian-Bulgarian) + +#>