code: public static String translit(String s) {
          if (s==null) return "";
          StringBuilder sb=new StringBuilder(s.length()+100);
          final int length=s.length();
          final int translitTableLength=translitTable.length();
  
          for (int i=0; i<length; i++) {
              char ch=s.charAt(i);
              //System.err.println("ch="+(int)ch);
  
              if ((ch>='\ufffd' && ch<='\ufffd') || (ch>='\ufffd' && ch<='\ufffd') ||
                  ch=='\ufffd' || ch=='\ufffd') {
                  int idx=translitTable.indexOf(ch);
                  char c;
                  if (idx>=0) {
                      for (idx++; idx<translitTableLength; idx++) {
                          c=translitTable.charAt(idx);
                          if ((c>='\ufffd' && c<='\ufffd') || (c>='\ufffd' && c<='\ufffd') ||
                              c=='\ufffd' || c=='\ufffd') break;
                          sb.append(c);
                      }
                  }
              }
              else {
                  sb.append(ch);
              }
          }
          return sb.toString();
      }
docs: Translates all non-basic-latin-letters characters into latin ones for use in URLs etc.
  Here is the implementation for cyrillic (Russian) alphabet. Unknown characters are omitted.
  
  @param s string to be translated
  @return translated string