Nick Nikolaev
Nick Nikolaev

Reputation: 141

How to parse Unicode symbols in C++? (like \u204c )

I wonder, but my app stops before printing "\u064B"

std::wcout << L"{\"data\":\"string\",\"text\":\"\u00b2\u00b2\u064B BOB \u00b2\u00b2\u00b2}" << std::endl;

if I print:

std::wcout << L"{\"data\":\"string\",\"text\":\"\u00b2\u00b2\u00b2 BOB \u00b2\u00b2\u00b2}" << std::endl;

all is okay, why?

Upvotes: 0

Views: 137

Answers (1)

01axel01christian
01axel01christian

Reputation: 970

You have to use "\\" when you want to print '\'

std::wcout << L"{\"data\":\"string\",\"text\":\"\\u00b2\\u00b2\\u064B BOB \\u00b2\\u00b2\\u00b2}" << std::endl;

Upvotes: 1

Related Questions