             shift = 0;
             result = 0;
             do {
-                b = String(data[index++]).toInt()! - 63
+                //unicode value :( refactor
+                for char in data.charAt(index++).unicodeScalars {
+                    b = Int(char.value)
+                }
+                b -= 63
                 result |= (b & 0x1f) << shift
                 shift += 5
             } while (b >= 0x20);

        var length : Int = count(data)
        var lat = 0, lng = 0
        while index < length {
            var b = 0
            var shift = 0
            var result = 0
            
            do {
                b = String(data[index++]).toInt()! - 63
                result |= (b & 0x1f) << shift
                shift += 5
                

import SwiftyJSON

extension String {
    func charAt (i: Int) -> String {
        return String(self[advance(self.startIndex, i)])
    }
}

