MCPcopy Create free account
hub / github.com/GNOME/gjs / is_utf8_label

Function is_utf8_label

gjs/text-encoding.cpp:233–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233[[nodiscard]]
234static bool is_utf8_label(const char* encoding) {
235 // We could be smarter about utf8 synonyms here.
236 // For now, we handle any casing and trailing/leading
237 // whitespace.
238 //
239 // is_utf8_label is only an optimization, so if a label
240 // doesn't match we just use the slower path.
241 if (g_ascii_strcasecmp(encoding, "utf-8") == 0 ||
242 g_ascii_strcasecmp(encoding, "utf8") == 0)
243 return true;
244
245 Gjs::AutoChar stripped{g_strdup(encoding)};
246 g_strstrip(stripped); // modifies in place
247 return g_ascii_strcasecmp(stripped, "utf-8") == 0 ||
248 g_ascii_strcasecmp(stripped, "utf8") == 0;
249}
250
251// Finds the length of a given data array, stopping at the first 0 byte.
252template <class T>

Callers 2

gjs_encode_to_uint8arrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected