Java – URL encoding / decoding replacement space on file name, which needs to be replaced

My product is a web application

Solution

You can also convert spaces to

See: URL encoding the space character: + or% 20?

There are a variety of other Java libraries for URL coding Here are two examples:

guava:

UrlEscapers.urlPathSegmentEscaper().escape(urlToEscape);

Spring framework:

UriUtils.encodePath(urlToEscape,Charsets.UTF_8.toString());
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>