#disable all keyboard layouts except english?

3 messages · Page 1 of 1 (latest)

shell iris
#

I have multiple languages on my keyboard and I read keys in my script and I do not want to allow cyrillic characters when ru layout is on. If it is not possible, what's an optimal solution?

vagrant vale
#

can you share images so i can see more visually what's going on?

sharp sand
#

Are you looking for something like this?
You can clean up some of them automatically by encode text as Cryllic and then decode it as ascii/utf8

$UserInput = 'Áçčèñţş ůşîñģ dïäçřïţïçš'
Pwsh> RemoveDiacritics -Text $UserInput
# outputs
Accents using diacritics
function RemoveDiacritics {
    <#
    .SYNOPSIS
        Removes diacritics from text, by utilizing Cryillic encoding. Works pretty for no effort.
    #>
    param(
        # text with accents and diacritics
        $Text,

        # Utf-8 seems to work best? Override if you want something else
        [ArgumentCompletions('Utf-8', 'Ascii')]
        $DecodeAs = 'Utf-8'
    )
    $bytes_cry = [Text.Encoding]::GetEncoding('Cyrillic').GetBytes( $Text )
    [Text.Encoding]::GetEncoding( $DecodeAs ).GetString( $bytes_cry )
}