lundi 26 janvier 2015

Converting STL unicode string to wxString gives empty string

My code is:



#include <string>
#include <iostream>
#include <wx/string.h>
int main(int n, char** c) {
std::string a = "你好";
wxString b = a;
std::cerr <<a.length()<<"/"<< b.Len()<<"\n";
}


I would expect the result to be something like "6/6" but I am getting "6/0". That is, b is empty. What am I doing wrong?


I have tried other conversions but they do not work either.


Compiling by:



g++ `wx-config --cxxflags --libs` -std=c++11 -o string-test string-test.cpp


wx version is 3.0.0.0. gcc version 4.9.2 20141101 (Red Hat 4.9.2-1) (GCC).


Aucun commentaire:

Enregistrer un commentaire