Here you can find the source of encodeSrcUrl(String fullUri)
private static String encodeSrcUrl(String fullUri)
//package com.java2s; // in accordance with the terms of the license agreement accompanying it. import java.io.*; public class Main { private static String encodeSrcUrl(String fullUri) { try {/*from ww w .ja va2s. co m*/ int length = fullUri.length(); StringBuffer buf = new StringBuffer(length); for (int i = 0; i < length; i++) { char c = fullUri.charAt(i); if (c <= 127) { buf.append(c); } else { byte[] bytes = fullUri.substring(i, i + 1).getBytes("UTF-8"); for (int j = 0; j < bytes.length; j++) { int b = bytes[j] & 255; buf.append('%'); if (b < 16) { buf.append('0'); } buf.append(Integer.toHexString(b)); } } } return buf.toString(); } catch (UnsupportedEncodingException e) { // will not happen because UTF-8 is required on all JVM's return fullUri; } } }