File tree 1 file changed +30
-0
lines changed 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ function RemoveAccents {
2
+ <#
3
+ . synopsis
4
+ Strip accents from text using cyrillic encoding. warning: this is a simple method, but does remove non-accented characters that weren't encodable
5
+ #>
6
+ param ( [string ] $Text )
7
+ $enc = [Text.Encoding ]::GetEncoding(' iso-8859-5' )
8
+ $enc.GetString ( $enc.GetBytes ( $Text ) )
9
+ }
10
+
11
+ RemoveAccents ' foo bår'
12
+
13
+ <#
14
+ I'm not 100% this is the best cyrillic to use, there's a few
15
+
16
+ Pwsh> [Text.Encoding]::GetEncodings() | ? displayname -Match 'cyr|cry'
17
+
18
+ CodePage Name DisplayName
19
+ -------- ---- -----------
20
+ 20880 IBM880 IBM EBCDIC (Cyrillic Russian)
21
+ 866 cp866 Cyrillic (DOS)
22
+ 21866 koi8-u Cyrillic (KOI8-U)
23
+ 1251 windows-1251 Cyrillic (Windows)
24
+ 10007 x-mac-cyrillic Cyrillic (Mac)
25
+ 28595 iso-8859-5 Cyrillic (ISO)
26
+ 20866 koi8-r Cyrillic (KOI8-R)
27
+ 855 IBM855 OEM Cyrillic
28
+ 21025 cp1025 IBM EBCDIC (Cyrillic Serbian-Bulgarian)
29
+
30
+ #>
You can’t perform that action at this time.
0 commit comments