1

I was trying to compile a c++ file but I got the following error :

error C3850: '\uD800': a universal-character-name specifies an invalid character

error C3850: '\uDFFF': a universal-character-name specifies an invalid character

The line having error is :

ValidateEmailAddr (L"\uD800\uDFFF@\uD800\uDFFF.com", false);

How to fix this issue ?

1
  • I suggest you to google the error before asking questions (Just copy and paste the first line in the Google search box). Happy coding. Commented Jul 22, 2016 at 8:43

1 Answer 1

3

The characters you specify are a surrogate pair - a pair of 16-bit quantites that together define one unicode code point (with value 0x103FF). The compiler is correct: this is not a valid code point, so you shouldn't be using it (see http://www.fileformat.info/info/unicode/char/103ff/index.htm).

If, despite this, you still want this value, you'll have to trick the compiler in some way. One possibility is to construct the value dynamically:

wchar_t bla [20]; bla [0] = 0xD800; bla [1] = 0xDFFF; ...etc. 

This is not as convenient, but really, the compiler is only trying to help you avoid an error here...

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.