Thread overview | ||||||
---|---|---|---|---|---|---|
|
July 27 Unicode in strings | ||||
---|---|---|---|---|
| ||||
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. |
July 27 Re: Unicode in strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Cecil Ward | 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 |
July 27 Re: Unicode in strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Cecil Ward | On Thursday, 27 July 2023 at 22:15:47 UTC, Cecil Ward wrote:
> How do I get a wstring or dstring with a code point of 0xA0 in it ?
note that you don't need wstring and dstring to express all unicode strings.
|
July 27 Re: Unicode in strings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D Ruppe | On Thursday, 27 July 2023 at 22:35:00 UTC, Adam D Ruppe wrote:
> On Thursday, 27 July 2023 at 22:15:47 UTC, Cecil Ward wrote:
>> How do I get a wstring or dstring with a code point of 0xA0 in it ?
>
> note that you don't need wstring and dstring to express all unicode strings.
I realised that I was probably generating UTF8 and only one byte, so I switched to \u00A0, I think. Must have got that wrong too because I was still getting the error message. I’ll try it again carefully.
|
Copyright © 1999-2021 by the D Language Foundation