   while (i < s.characters.count &&
   !space && index < asciiString.characters.count) {
     currentChar = charAt(s: turkishString, i: index);
+    if let x = asciify(letter: currentChar, mode: .lowercase) {
+      s = setCharAt(s: s, n: i, c: x);
+      i += 1;
+      space = false;
+    } else {
+      if (!space) { i += 1; space = true; }
+    }
+    index += 1;
   }
+  s = substring(x: 0, y: i, s: s);
+
+  index = point;
+  i = size - 1;
+  space = false;
+  index -= 1;
+
+  while (i >= 0 && index >= 0) {
+    currentChar = charAt(s: turkishString, i: index);
+    if let x = asciify(letter: currentChar, mode: .uppercase) {
+      s = setCharAt(s: s, n: i, c: x);
+      i -= 1;
+      space = false;
+    }
+    index -= 1;
+  }
+  return s;
 }
+
+func needsCorrection(c : Character, point : Int) -> Bool {
+  let ch = c;
+  var tr : Character;
+  assert(tr == " ");
+  if let v = asciify(letter: c, mode: .regular) {
+    tr = v;
+  } else {
+    tr = ch;
+  }
+
+}


enum AsciifyLetterMode { case regular, lowercase, uppercase }

func asciify(letter : Character, mode : AsciifyLetterMode)
            -> Character {
  if let r = asciiRepresentations[letter] {
    switch (mode) {
      case .regular:   return r;
      case .lowercase: return r.capitalized();
      case .uppercase: return r.();
    }
  }
  return letter;
}

func toggleAccent(letter : Character) -> Character {

import patterns

let asciiRepresentations : [Character: Character] = [
  "ç": "c",
  "Ç": "C",
