digitalmars.D.learn - Unicode in strings
- Cecil Ward (7/7) Jul 27 2023 How do I get a wstring or dstring with a code point of 0xA0 in it
- H. S. Teoh (7/14) Jul 27 2023 D strings are assumed to be encoded in UTF-8 / UTF-16 / UTF-32. So if
- Adam D Ruppe (3/5) Jul 27 2023 note that you don't need wstring and dstring to express all
- Cecil Ward (5/10) Jul 27 2023 I realised that I was probably generating UTF8 and only one byte,
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.
Jul 27 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
Jul 27 2023
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.
Jul 27 2023
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: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.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.
Jul 27 2023