core icon indicating copy to clipboard operation
core copied to clipboard

Issue 18458 - invalid utf on run.dlang.io causes server error

Open wilzbach opened this issue 7 years ago • 4 comments

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'); }

wilzbach avatar Feb 18 '18 22:02 wilzbach

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).

wilzbach avatar Feb 18 '18 22:02 wilzbach

Slight alteration with bug description body: It's anything (including) and over \x80.

aliak00 avatar Feb 18 '18 23:02 aliak00

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
}

wilzbach avatar Feb 19 '18 02:02 wilzbach

https://en.wikipedia.org/wiki/Extended_ASCII http://iconoun.com/articles/collisions/

wilzbach avatar Feb 19 '18 02:02 wilzbach