Here you can find the source of toAscii(String s)
public static String toAscii(String s)
//package com.java2s; public class Main { public static String toAscii(String s) { StringBuilder b = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c > 127) { String result = "?"; if (c >= 0x00c0 && c <= 0x00c5) { result = "A"; } else if (c == 0x00c6) { result = "AE"; } else if (c == 0x00c7) { result = "C"; } else if (c >= 0x00c8 && c <= 0x00cb) { result = "E"; } else if (c >= 0x00cc && c <= 0x00cf) { result = "F"; } else if (c == 0x00d0) { result = "D"; } else if (c == 0x00d1) { result = "N"; } else if (c >= 0x00d2 && c <= 0x00d6) { result = "O"; } else if (c == 0x00d7) { result = "x"; } else if (c == 0x00d8) { result = "O"; } else if (c >= 0x00d9 && c <= 0x00dc) { result = "U"; } else if (c == 0x00dd) { result = "Y"; } else if (c >= 0x00e0 && c <= 0x00e5) { result = "a"; } else if (c == 0x00e6) { result = "ae"; } else if (c == 0x00e7) { result = "c"; } else if (c >= 0x00e8 && c <= 0x00eb) { result = "e"; } else if (c >= 0x00ec && c <= 0x00ef) { result = "i"; } else if (c == 0x00f1) { result = "n"; } else if (c >= 0x00f2 && c <= 0x00f8) { result = "o"; } else if (c >= 0x00f9 && c <= 0x00fc) { result = "u"; } else if (c >= 0x00fd && c <= 0x00ff) { result = "y"; } else if (c >= 0x2018 && c <= 0x2019) { result = "\'"; } else if (c >= 0x201c && c <= 0x201e) { result = "\""; } else if (c >= 0x0213 && c <= 0x2014) { result = "-"; } else if (c >= 0x00A2 && c <= 0x00A5) { result = "$"; } else if (c == 0x2026) { result = "."; }//from w w w . j a va 2 s.com b.append(result); } else { b.append(c); } } return b.toString(); } }