Here you can find the source of encode(String _string, String _sEncoding)
Parameter | Description |
---|---|
_string | string to encode |
_sEncoding | character encoding |
public final static String encode(String _string, String _sEncoding)
//package com.java2s; /**/*from w w w. j a va 2 s . c o m*/ * PureInfo Force * @(#)URLUtil.java 1.0 2005-7-7 * * Copyright(c) 2004-2005, PureInfo Information Techonlogy Corp. Ltd. * All rights reserved, see the license file. * * www.pureinfo.com.cn */ import java.net.URLEncoder; public class Main { /** * Encodes the string into URL format. * * @param _string * string to encode * @param _sEncoding * character encoding * @return the encoded string in URL format */ public final static String encode(String _string, String _sEncoding) { try { return URLEncoder.encode(_string, _sEncoding); } catch (Exception ex) { throw new RuntimeException("failed to encode string into URL format using encoding " + _sEncoding, ex); } } }