Crash my webserver!

Vladimir Panteleev thecybershadow.lists at gmail.com
Sun May 14 14:57:07 UTC 2023


On Sunday, 14 May 2023 at 13:53:49 UTC, Andrea Fontana wrote:
> The UTF problem is actually a catched UTFException thrown by 
> urlencode/decode of std library.

This doesn't throw for me:

```d
void main()
{
	import std.uri;
	decode("\xFF");
	encode("\xFF");
}
```

But... looking at the implementation, it does have a baked-in 
UTF-8 decoder, which is a little ridiculous. `decode` actually 
decodes percent-encoded UTF-8, and then encodes it back, but 
makes no attempt to validate the non-encoded parts of the string. 
The module is pretty old though, so maybe it predates the 
facilities in `std.utf`.



More information about the Digitalmars-d mailing list