MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / fixUtf8

Method fixUtf8

src/helper.cpp:131–141  ·  view source on GitHub ↗

fixes UTF8 inplace – replaces invalid octets with replace character

Source from the content-addressed store, hash-verified

129
130// fixes UTF8 inplace – replaces invalid octets with replace character
131void Helper::fixUtf8(std::string& str) {
132 std::string temp;
133 try {
134 utf8::replace_invalid(str.begin(), str.end(), back_inserter(temp));
135 } catch( utf8::not_enough_room& e ) {
136#ifdef DEBUG
137std::cerr << "utf8::not_enough_room: " << str << std::endl;
138#endif
139 }
140 str = temp;
141}
142
143
144// converts Latin-1 to UTF-8

Callers

nothing calls this directly

Calls 3

replace_invalidFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected