1 5 6 package org.joseki.util; 7 8 import java.net.URLEncoder ; 9 import java.net.URLDecoder ; 10 import java.io.UnsupportedEncodingException ; 11 12 16 public class Convert 17 { 18 20 22 40 42 49 public static String encWWWForm(String s) 50 { 51 try { 52 return URLEncoder.encode(s, "UTF-8") ; 53 } catch (UnsupportedEncodingException ex) { return null ;} 55 } 56 57 59 public static String encWWWForm(StringBuffer sbuff) 60 { 61 return encWWWForm(sbuff.toString()) ; 62 } 63 64 65 public static String decWWWForm(String s) 66 { 67 try { 68 return URLDecoder.decode(s, "UTF-8") ; 69 } catch (UnsupportedEncodingException ex) { return null ;} 71 } 72 73 public static String decWWWForm(StringBuffer sbuff) 74 { 75 return decWWWForm(sbuff.toString()) ; 76 } 77 78 } 79 80 106 107 | Popular Tags |