在GWT中使用UTF-8编码字符串

问题描述:

有没有办法在GWT中用UTF-8编码一个String?换句话说,是否存在一个与java.net.URLEncoder.encode(toEncode,UTF-8)等价的GWT兼容?

Is there a way to encode a String with UTF-8 in GWT? In other words, is there a GWT-compatible equivalent to java.net.URLEncoder.encode(toEncode, "UTF-8")?

是的,它是com.google.gwt.http.client.Url.encode(),JavaDoc: http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/http/client/ URL.html

Yes, it's com.google.gwt.http.client.Url.encode(), JavaDoc: http://google-web-toolkit.googlecode.com/svn/javadoc/1.6/com/google/gwt/http/client/URL.html