DMD: invalid UTF character `\U0000d800`

Steven Schveighoffer schveiguy at gmail.com
Sun Nov 8 13:10:17 UTC 2020


On 11/8/20 5:47 AM, Per Nordlöw wrote:
> On Saturday, 7 November 2020 at 17:49:54 UTC, Jacob Carlborg wrote:
>> [1] https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF
> 
> Thanks!
> 
> I'm only using these UTF characters to create ranges that source code 
> characters as checked against during parsing. Therefore I would like to 
> just convert these to a `dchar` for now using a `cast`. Can I just do, 
> for instance,
> 
>      cast(dchar)0x0000d8000
> 
> for
> 
>      `\U0000d800`
> 
> to accomplish this?

Yes, use the cast. It should work.

It's just the D grammar that is stopping you, a dchar is just an integer 
under the hood, so the cast should be fine.

-Steve


More information about the Digitalmars-d-learn mailing list