Skip to content

Refine UriUtils#decode and StringUtils#uriDecode implementation and documentation #34570

Closed as not planned
@gotson

Description

@gotson

I believe i found an issue with UriUtils.decode(String source, Charset charset).

When the source string contains the character (Right Single Quotation Mark - unicode 2019), and other URI characters (to trigger the rewrite of the string), the character is changed to (End of Medium - unicode 0019).

Here is a sample test in Kotlin that highlights the behaviour:

@Test
  fun test(){
    val c = '\u2019'
    val s = "%20$c"
    val expected = " $c"

    val d = UriUtils.decode(s, Charsets.UTF_8)

    assertThat(d).isEqualTo(expected)
  }

Here is the difference shown from the failing test:

" ’"
" �"

I am using Spring 6.2.0.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)status: supersededAn issue that has been superseded by anothertype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions