mirror of
https://github.com/gbevin/urlencoder.git
synced 2025-04-24 23:07:12 -07:00
Minor cleanup
This commit is contained in:
parent
c9c36c444f
commit
cdad2dd145
1 changed files with 7 additions and 7 deletions
14
README.md
14
README.md
|
@ -1,6 +1,6 @@
|
|||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
[](https://www.oracle.com/java/technologies/javase/jdk11-archive-downloads.html)
|
||||
[](https://s01.oss.sonatype.org/content/repositories/snapshots/com/uwyn/urlencoder/)
|
||||
[](https://s01.oss.sonatype.org/content/repositories/snapshots/com/uwyn/urlencoder/)
|
||||
[](https://github.com/gbevin/urlencoder/releases/latest)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/com.uwyn/urlencoder)
|
||||
[](https://sonarcloud.io/dashboard?id=gbevin_urlencoder)
|
||||
|
@ -104,28 +104,28 @@ Apart for being quite inefficient, some URL components encoded with `URLEncoder.
|
|||
|
||||
For example, a simply search query such as:
|
||||
|
||||
```kotlin
|
||||
var u = URLEncoder.encode("foo + bar", StandardCharsets.UTF_8);
|
||||
```java
|
||||
var u = URLEncoder.encode("foo +bar", StandardCharsets.UTF_8);
|
||||
```
|
||||
|
||||
would be encoded as:
|
||||
|
||||
```
|
||||
foo+%28+bar
|
||||
foo+%2Bbar
|
||||
```
|
||||
|
||||
Trying to decode it with [Spring](https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/UriUtils.html#decode(java.lang.String,java.lang.String)), for example:
|
||||
|
||||
```kotlin
|
||||
```java
|
||||
UriUtils.decode(u, StandardCharsets.UTF_8));
|
||||
```
|
||||
|
||||
would return:
|
||||
|
||||
```
|
||||
foo+++bar
|
||||
foo++bar
|
||||
```
|
||||
|
||||
Unfortunately, decoding with [Uri.decode](https://developer.android.com/reference/android/net/Uri#decode(java.lang.String)) on Android, [decodeURI](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURI) in Javascript, etc. would yield the exact same result.
|
||||
|
||||

|
||||

|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue