Here you can find the source of encodeValue(String dirtyValue)
Parameter | Description |
---|---|
dirtyValue | a parameter |
public static String encodeValue(String dirtyValue)
//package com.java2s; //License from project: Open Source License import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { /**/*w ww . j a va 2 s . c om*/ * Helper function for character encoding * * @param dirtyValue * @return encoded value */ public static String encodeValue(String dirtyValue) { String cleanValue = ""; try { cleanValue = URLEncoder.encode(dirtyValue, "UTF-8").replace("+", "%20"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } return cleanValue; } }