Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-17 Thread via Digitalmars-d-learn
On Tuesday, 16 September 2014 at 20:19:24 UTC, notna wrote: Thanks AsmMan, Found http://msdn.microsoft.com/en-us/library/windows/desktop/ms724432%28v=vs.85%29.aspx and with your help, now understand :) The syntax below prints a blank after my username, so the slice seems a bit too long :O S

Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-16 Thread notna via Digitalmars-d-learn
Thanks AsmMan, Found http://msdn.microsoft.com/en-us/library/windows/desktop/ms724432%28v=vs.85%29.aspx and with your help, now understand :) The syntax below prints a blank after my username, so the slice seems a bit too long :O So my "final solution" looks like: module main; import st

Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-16 Thread notna via Digitalmars-d-learn
Thanks Ali. As always, your examples and explanations are amazingly clear and "easy to understand". On Monday, 15 September 2014 at 23:57:59 UTC, Ali Çehreli wrote: You must make use of the returned value to slice your wstring. Something like this (not compiled): auto actualLength = Ge

Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-15 Thread AsmMan via Digitalmars-d-learn
On Monday, 15 September 2014 at 23:57:59 UTC, Ali Çehreli wrote: On 09/15/2014 04:36 PM, notna wrote: > WCHAR lpwszUsername[254]; > debug writefln("lpwszUsername.sizeof is %s, WCHAR.sizeof is > %s", lpwszUsername.sizeof, WCHAR.sizeof); > // DWORD dUsername2 = lpwszUser

Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-15 Thread Ali Çehreli via Digitalmars-d-learn
On 09/15/2014 04:36 PM, notna wrote: > WCHAR lpwszUsername[254]; > debug writefln("lpwszUsername.sizeof is %s, WCHAR.sizeof is > %s", lpwszUsername.sizeof, WCHAR.sizeof); > // DWORD dUsername2 = lpwszUsername.sizeof / WCHAR.sizeof; > DWORD dUsername2 = 254; >

Re: core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-15 Thread notna via Digitalmars-d-learn
ERROR": - core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value 0x0041022C 0x004074B7 0x004074A1 0x00406E66 0x00406DCF 0x00406D28 0x00406C41 0x00406828 0x0040678C 0x0040B66E 0x0040B643 0x0040B559 0x00408737 0x7

core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value

2014-09-15 Thread notna via Digitalmars-d-learn
- - dmd -v -w main.d OUTPUT incl. "ERROR": --------- core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value 0x0041022C 0x004074B7 0x004074A1 0x00406E66 0x00406DCF 0x00406D28 0x00406C41 0x00406828 0x0040678C 0x0040B66