File: boost.cpp

package info (click to toggle)
protobuf 3.25.4-2
  • links: PTS
  • area: main
  • in suites: experimental
  • size: 45,944 kB
  • sloc: cpp: 204,199; java: 87,622; ansic: 81,204; objc: 58,434; cs: 27,303; python: 22,799; php: 11,340; ruby: 8,637; pascal: 3,325; xml: 2,333; sh: 1,331; makefile: 538; lisp: 86; awk: 17
file content (15 lines) | stat: -rw-r--r-- 387 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#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;
}