Hi everybody, I need to escape utf-8 to their html format.
I use the function below and the gwt compiler to JS doesn't like it: it says "duplicate case" for all cases starting with and after the à a) Can somebody tell me what I am doing wrong ? b) Is there any better way (using official GWT code) to do it ? thanks didier public static final String escapeHTML(String s){ StringBuffer sb = new StringBuffer(); int n = s.length(); for (int i = 0; i < n; i++) { char c = s.charAt(i); switch (c) { case '<': sb.append("<"); break; case '>': sb.append(">"); break; case '&': sb.append("&"); break; case '"': sb.append("""); break; case 'à': sb.append("à"); break; case 'À': sb.append("À"); break; case 'â': sb.append("â"); break; case 'Â': sb.append("Â"); break; case 'ä': sb.append("ä"); break; case 'Ä': sb.append("Ä"); break; case 'å': sb.append("å"); break; case 'Å': sb.append("Å"); break; case 'æ': sb.append("æ"); break; case 'Æ': sb.append("Æ"); break; case 'ç': sb.append("ç"); break; case 'Ç': sb.append("Ç"); break; case 'é': sb.append("é"); break; case 'É': sb.append("É"); break; case 'è': sb.append("è"); break; case 'È': sb.append("È"); break; case 'ê': sb.append("ê"); break; case 'Ê': sb.append("Ê"); break; case 'ë': sb.append("ë"); break; case 'Ë': sb.append("Ë"); break; case 'ï': sb.append("ï"); break; case 'Ï': sb.append("Ï"); break; case 'ô': sb.append("ô"); break; case 'Ô': sb.append("Ô"); break; case 'ö': sb.append("ö"); break; case 'Ö': sb.append("Ö"); break; case 'ø': sb.append("ø"); break; case 'Ø': sb.append("Ø"); break; case 'ß': sb.append("ß"); break; case 'ù': sb.append("ù"); break; case 'Ù': sb.append("Ù"); break; case 'û': sb.append("û"); break; case 'Û': sb.append("Û"); break; case 'ü': sb.append("ü"); break; case 'Ü': sb.append("Ü"); break; case '®': sb.append("®"); break; case '©': sb.append("©"); break; case '€': sb.append("€"); break; case ' ': sb.append(" "); break; default: sb.append(c); break; } } return sb.toString(); } -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.