core
core copied to clipboard
Issue 18458 - invalid utf on run.dlang.io causes server error
Moved from https://issues.dlang.org/show_bug.cgi?id=18458
Actually anything (including) '\x80' will cause a server error.
import std.stdio : writeln;
void main() { writeln('\x80'); }
The server reply is:
{
"statusMessage":"Invalid UTF-8 sequence (at index 1)",
"statusDebugMessage":"Invalid UTF sequence: 80x - Invalid UTF-8 sequence (at index 1)"
}
The frontend should definitely display these error messages.
I don't have time today to dig into this, but Vibe.d just serialized an Exception toString
here (https://github.com/vibe-d/vibe.d/blob/a991c962f01c208384b325fbf5afa081337c5c24/web/vibe/web/rest.d#L287).
Slight alteration with bug description body: It's anything (including) and over \x80.
FYI: https://github.com/dlang-tour/core/pull/673, but I don't like the solution there.
The problem can be reproduced locally easily:
void main(string[] args)
{
import std.stdio;
// but not extended ASCII
string line = "\xB5"; // [181]
line.writeln; // works
import std.range.primitives : front;
line.front.writeln; // fails
}
https://en.wikipedia.org/wiki/Extended_ASCII http://iconoun.com/articles/collisions/