url utf8编码互转

java

package com;

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

/**
 * Created by Administrator on 2015/7/6.
 */
public class Test {
    public static void main(String arg0[]) throws UnsupportedEncodingException {
        String temp = "QQ ee第一层.jpg";

        String utf8=URLEncoder.encode(temp, "UTF-8");
        String gbk = URLDecoder.decode(utf8, "UTF-8");

        System.out.println(utf8);
        System.out.println(gbk);

    }
}

javascript

var encoding = encodeURI(title);


你可能感兴趣的:(java)