dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead

kdevel kdevel at vogtner.de
Mon Nov 15 19:59:40 UTC 2021


On Monday, 15 November 2021 at 08:22:13 UTC, user1234 wrote:
> On Monday, 15 November 2021 at 08:20:57 UTC, user1234 wrote:
>> On Friday, 12 November 2021 at 10:42:15 UTC, kdevel wrote:
>>> This does not yet compile:
>>>
>>>    [...]
>>>           R = ubyte[]`
>>>      must satisfy one of the following constraints:
>>>    `       isSomeChar!(ElementType!R)
>>>           is(StringTypeOf!R)`
>>
>> auto-decoding or not... you need to decode from whatever is 
>> the OS encoding (must be ancient ANSI I presume ?) to UTF-8.
>
> I meant decode then re-enc to utf

You can only decode what has been (or is ment to be) encoded. 
Except for '.', '\0', and '/' the character values (0 .. 255) 
have no meaning within a filename.


More information about the Digitalmars-d mailing list