derekhh
derekhh

Reputation: 5532

A C++ equivalent for Encoding.Unicode.GetByteCount(str)?

This function calculates the number of bytes of the string "str" when encoded in UTF-16.

My question is, what would be a C++ equivalent to implement this?

Upvotes: 2

Views: 247

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473302

Just standard C++

Standard C++, including C++11, is not Unicode aware. To get the kind of measuring function you're talking about, you'll have to use another support library like ICU or Windows API functions or iconv or somesuch.

Upvotes: 2

Related Questions