c++ - How can i calcuate unicode characters? -
i have simple encoding program, , want add unicode characters. i'm doing math, converting decimal value hex, unicode. problem conversion decimal hex, gives me string, , don't know way convert string char (not char[]).
how can convert decimal number unicode character (char) equivalent out creating string?
heres code trying figure out, we've established wont work:
#include <iostream> #include <sstream> using namespace std; int main(){ int decimal_value = 1111; stringstream ss; ss<< hex << decimal_value; // int decimal_value string res ( ss.str() ); std::ostringstream oss; oss << "\\u0" << res; string var = oss.str(); cout << var << "\n" << "\u0457" << "\n"; return 0; }
output:
\u0457 ї
Comments
Post a Comment