-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Remove-Accents-using-Cyrillic.ps1
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
#> |