Unicode in strings

H. S. Teoh hsteoh at qfbox.info
Thu Jul 27 22:32:28 UTC 2023


On Thu, Jul 27, 2023 at 10:15:47PM +0000, Cecil Ward via Digitalmars-d-learn wrote:
> How do I get a wstring or dstring with a code point of 0xA0 in it ?
> That’s a type of space, is it? I keep getting a message from the LDC
> compiler something like "Outside Unicode code space" in my unittests
> when this is the first character in a wstring. I’ve tried all sorts of
> escape sequences but I must simply be misunderstanding the docs. I
> could always copy-paste a real live one into a double quoted string
> and be done with it, I suppose.

D strings are assumed to be encoded in UTF-8 / UTF-16 / UTF-32. So if
you wrote something like `\xA0` in your string will likely generate an
invalid encoding.  Try instead `\u00A0`.


T

-- 
Ph.D. = Permanent head Damage


More information about the Digitalmars-d-learn mailing list