Skip to content

Percent-encoding of query wrong for ISO-2022-JP #557

Description

@annevk

If you look at the number of state transitions (hint: count %1B instances) in the example below you can see that invoking the encoder code-point-by-code-point does not match implementations.

 function encode(input, output, desc) {
   test(function() {
     var a = document.createElement("a") // <a> uses document encoding for URL's query
     a.href = "https://example.com/?" + input
     assert_equals(a.search.substr(1), output) // remove leading "?"
   }, "iso-2022-jp encoder: " + desc)
 }

 encode("\uFF90\u4F69", "%1B$B%_PP%1B(B");
 encode("\uFF90a\u4F69", "%1B$B%_%1B(Ba%1B$BPP%1B(B");

There might be a related thing here, discovered in web-platform-tests/wpt#26158 by @JKingweb, that implementations skip invoking encoders if the input is entirely in the ASCII range. (Again, something that uniquely applies to ISO-2022-JP. Form submission should be checked here as well before deciding on something.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions