How to declare UTF-8 string in C++

2 Answers

0 votes
#include <iostream>     

int main () {
    std::string str = u8"UTF-8 string";
   
    std::cout << str;
}
  
  
  
/*
run:
  
UTF-8 string
  
*/

 



answered Nov 26, 2022 by avibootz
0 votes
#include <iostream>     
 
int main () {
    std::string str = u8"\u002A";
    
    std::cout << str;
}
   
   
   
/*
run:
   
*
   
*/

 



answered Nov 28, 2022 by avibootz

Related questions

...