HaxeFoundation / HaxeFoundation/haxe

[java vs js] StringTools.urlEncode/urlDecode behaves differently

Open
#4,564 2 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
platform-java test-disabled
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

In the java backend `StringTools.urlEncode` encodes characters like `~` `(` `)` and `'`, whereas the js backend doesn't.
`StringTools.urlDecode` also works differently for non-ASCII characters, in particular java replaces them with U+FFFD, and javascript throws an exception.
Our workaround was to override the java std StringTools with code taken from https://github.com/mozilla/rhino/ which replicates the js behaviour.
Check out https://github.com/exFalso/haxe-qc/ for a QuickCheck-based test for these functions alongside Std.parseX functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.