问题
I'm trying to decode html entities in Java, but I noticed that
URLDecoder.decode(String stringToDecode, String charset);
is deprecated.
What should I use instead of it?
回答1:
The method you mention is not deprecated. See here -> http://docs.oracle.com/javase/7/docs/api/java/net/URLDecoder.html
URLDecoder.decode(String stringToDecode)
on the other hand is.
回答2:
It is not deprecated. The decode method with two parameters is not deprecated. Please check again. The first parameter is the String to decode; the second is the name of the character encoding to use (e.g., "UTF-8").
Refer: http://docs.oracle.com/javase/6/docs/api/java/net/URLDecoder.html
回答3:
It's not deprecated. The overloaded decode method that doesn't take a character encoding argument is deprecated.
来源:https://stackoverflow.com/questions/16306607/how-do-decode-url-entities-in-java