[Issue 6125] to!string doesn't throw on invalid UTF sequence

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P3

--


[Issue 6125] to!string doesn't throw on invalid UTF sequence

2019-12-11 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

--- Comment #4 from berni44  ---
The original bug isn't windows specific. I don't know if the example from Lucia
Cojocaru can be considered the same bug...

--


[Issue 6125] to!string doesn't throw on invalid UTF sequence

2019-12-11 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

berni44  changed:

   What|Removed |Added

 CC||bugzi...@d-ecke.de
 OS|Windows |All

--


[Issue 6125] to!string doesn't throw on invalid UTF sequence

2016-11-21 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

Lucia Cojocaru  changed:

   What|Removed |Added

 CC||lucia.mcojoc...@gmail.com

--- Comment #3 from Lucia Cojocaru  ---
Is this a Windows specific bug?

I tested the following on Linux 64:
  1 import std.conv;
  2 import std.stdio;
  3 import std.utf;
  4 
  5 void main()
  6 {
  7 auto x = to!string(cast(char)191);
  8 auto z = toUTF8(x);
  9 writeln(x);
 10 
 11 
 12 foreach (y; 0 .. 16)
 13 foreach (r; 0 .. 16)
 14 {
 15 auto buffer = to!string(cast(char)(16 * r + y));
 16 auto b = toUTF8(buffer);
 17 writeln(b);
 18 //auto result = buffer.toUTF16z;  // call to utf16z for the
winapi
 19 }
 20 }


Only the commented line throws:
core.exception.UnicodeException@src/rt/util/utf.d(292): invalid UTF-8 sequence

--


[Issue 6125] to!string doesn't throw on invalid UTF sequence

2016-10-15 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

Andrei Alexandrescu  changed:

   What|Removed |Added

   Keywords||bootcamp

--- Comment #2 from Andrei Alexandrescu  ---
Well since it doesn't throw we may as well make it nothrow :o) and use the
replacement char, or add an overload. I'll bootcamp this.

--


[Issue 6125] to!string doesn't throw on invalid UTF sequence

2016-08-27 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

Andrej Mitrovic  changed:

   What|Removed |Added

 CC||and...@erdani.com

--- Comment #1 from Andrej Mitrovic  ---
-
import std.conv;
import std.stdio;

void main()
{
auto x = to!string(cast(char)255);
writeln(x);
}
-

Outputs:
[Decode error - output not utf-8]

I think the to!() routines should be UTF safe so the call to to!string above
should throw an exception. Is this right Andrei?

--


[Issue 6125] to!string doesn't throw on invalid UTF sequence

2014-05-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=6125

Behnam Esfahbod dl...@behnam.es changed:

   What|Removed |Added

 CC||dl...@behnam.es

--