Java URL Encode encode(final String content, final String encoding)

Here you can find the source of encode(final String content, final String encoding)

Description

encode

License

Open Source License

Declaration

private static String encode(final String content, final String encoding) 

Method Source Code


//package com.java2s;
import java.io.UnsupportedEncodingException;

import java.net.URLEncoder;

public class Main {
    private static String encode(final String content, final String encoding) {
        try {// ww w  . j av  a 2 s  . c o m
            return URLEncoder.encode(content, encoding != null ? encoding : "UTF-8");
        } catch (UnsupportedEncodingException problem) {
            throw new IllegalArgumentException(problem);
        }
    }
}

Related

  1. encode(byte[] bytes, String encoding)
  2. encode(final Object id)
  3. encode(final String raw)
  4. encode(final String s, final String enc)
  5. encode(final String string)
  6. encode(final String value, final String charset)