Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    /** Default charsets */
    public static final String DEFAULT_CONTENT_CHARSET = "ISO-8859-1";

    public static String decode(final String content, final String encoding) {
        try {
            return URLDecoder.decode(content, encoding != null ? encoding : DEFAULT_CONTENT_CHARSET);
        } catch (UnsupportedEncodingException problem) {
            throw new IllegalArgumentException(problem);
        }
    }
}