std.uri.decodeComponent decodes invalid UTF-8

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Aug 5 19:28:06 UTC 2025


On 05/08/2025 3:09 PM, kdevel wrote:
> Has the UTF-8 decoding been implemented in multiple places? [3]
Yes but also no.

A URI is ASCII.

Any input to that function will be ASCII, it won't be UTF-8.

The hex encoding is not UTF-8, its its own encoding, that gets reencoded 
out to UTF-8.

https://github.com/dlang/phobos/blob/ae07a90aabb34e34e1e73419780549aeb95e8f9c/std/uri.d#L194

This does not validate to the extent that one may like.


More information about the Digitalmars-d mailing list