How do decode URL entities in java?

时间秒杀一切 提交于 2019-12-11 00:06:35

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!