当前自己知道的方法大概有以下两种:
(一)直接转成utf8
其实在前面的文章中已经有了。
osgEarth::Annotation::PlaceNode *pn = new osgEarth::Annotation::PlaceNode(GeoPoint(geoSRS, 110, 34), String2UTF8("中国"), style);
std::wstring String2Wstring(const std::string& str)
{if (str.empty()){return L"";}unsigned len = str.size() + 1;setlocale(LC_CTYPE, "");wchar_t* p = new wchar_t[len];mbstowcs(p, str.c_str(), len);std::wstring w_str(p);delete[] p;return w_str;
}std::string String2UTF8(const std::string& str)
{std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;std::wstring temp = String2Wstring(str);std::string stri