Invoke-StringNormalization.psm1

function Invoke-StringNormalization {
    param (
        [Parameter(Mandatory)]
        [string]$InputString, 
        [ValidateSet("Germany", "Scandinavia")]
        [string]$Locality
    )

    $OutputEncoding = [System.Text.Encoding]::Unicode

    $InputString = $InputString.Trim()

    $normalizationCharacters = @()

    switch ($Locality) {
        "Germany" {
            $normalizationCharacters += @(
                [PSCustomObject]@{ Character = "Ä"; Replacement = "Ae" }
                [PSCustomObject]@{ Character = "ä"; Replacement = "ae" }
                [PSCustomObject]@{ Character = "Ö"; Replacement = "Oe" }
                [PSCustomObject]@{ Character = "ö"; Replacement = "oe" }
                [PSCustomObject]@{ Character = "Ü"; Replacement = "Ue" }
                [PSCustomObject]@{ Character = "ü"; Replacement = "ue" }
            )
        }
        Default {
            $normalizationCharacters += @(
                [PSCustomObject]@{ Character = "Ä"; Replacement = "A" }
                [PSCustomObject]@{ Character = "ä"; Replacement = "a" }
                [PSCustomObject]@{ Character = "Ö"; Replacement = "O" }
                [PSCustomObject]@{ Character = "ö"; Replacement = "o" }
                [PSCustomObject]@{ Character = "Ü"; Replacement = "U" }
                [PSCustomObject]@{ Character = "ü"; Replacement = "u" }
            )
        }
    }

    $normalizationCharacters += @(
        [PSCustomObject]@{ Character = " "; Replacement = " " }
        [PSCustomObject]@{ Character = "ß"; Replacement = "ss" }
        [PSCustomObject]@{ Character = "ẞ"; Replacement = "SS" }
        [PSCustomObject]@{ Character = "Å"; Replacement = "A" }
        [PSCustomObject]@{ Character = "å"; Replacement = "a" }
        [PSCustomObject]@{ Character = "Ø"; Replacement = "O" }
        [PSCustomObject]@{ Character = "ø"; Replacement = "o" }
        [PSCustomObject]@{ Character = "Æ"; Replacement = "Ae" }
        [PSCustomObject]@{ Character = "æ"; Replacement = "ae" }
        [PSCustomObject]@{ Character = "Ő"; Replacement = "O" }
        [PSCustomObject]@{ Character = "ő"; Replacement = "o" }
        [PSCustomObject]@{ Character = "Ű"; Replacement = "U" }
        [PSCustomObject]@{ Character = "ű"; Replacement = "u" }
        [PSCustomObject]@{ Character = "Á"; Replacement = "A" }
        [PSCustomObject]@{ Character = "á"; Replacement = "a" }
        [PSCustomObject]@{ Character = "À"; Replacement = "A" }
        [PSCustomObject]@{ Character = "à"; Replacement = "a" }
        [PSCustomObject]@{ Character = "É"; Replacement = "E" }
        [PSCustomObject]@{ Character = "é"; Replacement = "e" }
        [PSCustomObject]@{ Character = "È"; Replacement = "E" }
        [PSCustomObject]@{ Character = "è"; Replacement = "e" }
        [PSCustomObject]@{ Character = "Í"; Replacement = "I" }
        [PSCustomObject]@{ Character = "í"; Replacement = "i" }
        [PSCustomObject]@{ Character = "Ì"; Replacement = "I" }
        [PSCustomObject]@{ Character = "ì"; Replacement = "i" }
        [PSCustomObject]@{ Character = "Ó"; Replacement = "O" }
        [PSCustomObject]@{ Character = "ó"; Replacement = "o" }
        [PSCustomObject]@{ Character = "Ò"; Replacement = "O" }
        [PSCustomObject]@{ Character = "ò"; Replacement = "o" }
        [PSCustomObject]@{ Character = "Ú"; Replacement = "U" }
        [PSCustomObject]@{ Character = "ú"; Replacement = "u" }
        [PSCustomObject]@{ Character = "Ù"; Replacement = "U" }
        [PSCustomObject]@{ Character = "ù"; Replacement = "u" }
    )

    foreach ($character in $NormalizationCharacters) {
        $InputString = $InputString.Replace($character.Character, $character.Replacement)
    }

    return $InputString
}