Protocol Buffers - Google's data interchange format (grpc依赖)
https://developers.google.com/protocol-buffers/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
387 B
16 lines
387 B
2 years ago
|
#include <boost/locale.hpp>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
/* Return 0 on sucess, -1 on error */
|
||
|
extern "C" int utf8_boost(const unsigned char* data, int len) {
|
||
|
try {
|
||
|
boost::locale::conv::utf_to_utf<char>(data, data + len,
|
||
|
boost::locale::conv::stop);
|
||
|
} catch (const boost::locale::conv::conversion_error& ex) {
|
||
|
return -1;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|