Here you can find the source of uriEncode(String decoded)
public static String uriEncode(String decoded) throws UnsupportedEncodingException
//package com.java2s; /* --- BEGIN COPYRIGHT BLOCK --- * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License.// ww w. ja v a 2s. co m * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * * Copyright (C) 2007 Red Hat, Inc. * All rights reserved. * --- END COPYRIGHT BLOCK --- */ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; public class Main { public static String uriEncode(String decoded) throws UnsupportedEncodingException { return URLEncoder.encode(decoded, "UTF-8"); } }