Skip to main content
Oopsie! "Beautified" some unicode right out of the code block.
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64
public static string RemapInternationalCharToAscii (char c) {
    string s = c.ToString ().ToLowerInvariant ();
    if ("àåáâäãåa""àåáâäãåą".Contains (s) ) {
        return "a";
    } else if ("èéêëe""èéêëę".Contains (s) ) {
        return "e";
    } else if ("ìíîïi""ìíîïı".Contains (s) ) {
        return "i";
    } else if ("òóôõöøoð""òóôõöøőð".Contains (s) ) {
        return "o";
    } else if ("ùúûüuu""ùúûüŭů".Contains (s) ) {
        return "u";
    } else if ("çccc""çćčĉ".Contains (s) ) {
        return "c";
    } else if ("zzž""żźž".Contains (s) ) {
        return "z";
    } else if ("ssšs""śşšŝ".Contains (s) ) {
        return "s";
    } else if ("ñn""ñń".Contains (s) ) {
        return "n";
    } else if ("ýÿ".Contains (s) ) {
        return "y";
    } else if ("gg""ğĝ".Contains (s) ) {
        return "g";
    } else if (c == 'r''ř') {
        return "r";
    } else if (c == 'l''ł') {
        return "l";
    } else if (c == 'd''đ') {
        return "d";
    } else if (c == 'ß') {
        return "ss";
    } else if (c == 'Þ') {
        return "th";
    } else if (c == 'h''ĥ') {
        return "h";
    } else if (c == 'j''ĵ') {
        return "j";
    } else {
        return "";
    }
}
public static string RemapInternationalCharToAscii (char c) {
    string s = c.ToString ().ToLowerInvariant ();
    if ("àåáâäãåa".Contains (s) ) {
        return "a";
    } else if ("èéêëe".Contains (s) ) {
        return "e";
    } else if ("ìíîïi".Contains (s) ) {
        return "i";
    } else if ("òóôõöøoð".Contains (s) ) {
        return "o";
    } else if ("ùúûüuu".Contains (s) ) {
        return "u";
    } else if ("çccc".Contains (s) ) {
        return "c";
    } else if ("zzž".Contains (s) ) {
        return "z";
    } else if ("ssšs".Contains (s) ) {
        return "s";
    } else if ("ñn".Contains (s) ) {
        return "n";
    } else if ("ýÿ".Contains (s) ) {
        return "y";
    } else if ("gg".Contains (s) ) {
        return "g";
    } else if (c == 'r') {
        return "r";
    } else if (c == 'l') {
        return "l";
    } else if (c == 'd') {
        return "d";
    } else if (c == 'ß') {
        return "ss";
    } else if (c == 'Þ') {
        return "th";
    } else if (c == 'h') {
        return "h";
    } else if (c == 'j') {
        return "j";
    } else {
        return "";
    }
}
public static string RemapInternationalCharToAscii (char c) {
    string s = c.ToString ().ToLowerInvariant ();
    if ("àåáâäãåą".Contains (s) ) {
        return "a";
    } else if ("èéêëę".Contains (s) ) {
        return "e";
    } else if ("ìíîïı".Contains (s) ) {
        return "i";
    } else if ("òóôõöøőð".Contains (s) ) {
        return "o";
    } else if ("ùúûüŭů".Contains (s) ) {
        return "u";
    } else if ("çćčĉ".Contains (s) ) {
        return "c";
    } else if ("żźž".Contains (s) ) {
        return "z";
    } else if ("śşšŝ".Contains (s) ) {
        return "s";
    } else if ("ñń".Contains (s) ) {
        return "n";
    } else if ("ýÿ".Contains (s) ) {
        return "y";
    } else if ("ğĝ".Contains (s) ) {
        return "g";
    } else if (c == 'ř') {
        return "r";
    } else if (c == 'ł') {
        return "l";
    } else if (c == 'đ') {
        return "d";
    } else if (c == 'ß') {
        return "ss";
    } else if (c == 'Þ') {
        return "th";
    } else if (c == 'ĥ') {
        return "h";
    } else if (c == 'ĵ') {
        return "j";
    } else {
        return "";
    }
}
added 1 character in body
Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64

Comment replies will often work with unicode. EG: Péter Török can be reached by both @Peter and Péter@Péter.

Comment replies will often work with unicode. EG: Péter Török can be reached by both @Peter and Péter.

Comment replies will often work with unicode. EG: Péter Török can be reached by both @Peter and @Péter.

Source Link
Brock Adams
  • 13k
  • 5
  • 39
  • 64
Loading