Java String Escape percentEncode(String value)

Here you can find the source of percentEncode(String value)

Description

percent Encode

License

Open Source License

Declaration

private static String percentEncode(String value) throws UnsupportedEncodingException 

Method Source Code


//package com.java2s;
/*/*from w ww  .  j a va  2 s .  c om*/
 * Copyright 2015 Aliyun.com All right reserved. This software is the
 * confidential and proprietary information of Aliyun.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Aliyun.com .
 */

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

public class Main {
    private static final String encode = "UTF-8";
    private static final String EMPTY = "";

    private static String percentEncode(String value) throws UnsupportedEncodingException {
        return value == null ? EMPTY : URLEncoder.encode(value, encode);
    }
}

Related

  1. escapeXML(String message)
  2. escapeXml(String str)
  3. escapeXML(String str)
  4. percentEncode(String s)
  5. percentEncode(String s)
  6. percentEncode(String value, String encoding)
  7. percentEncodeRfc3986(final String string)