Glib::ustring validate_utf(const Glib::ustring& string) { if(string.validate()) return string; else return m::convert(string, MLIB_UTF_CHARSET_NAME, MLIB_UTF_CHARSET_NAME); }
void BibData::addExtra (Glib::ustring const &key, Glib::ustring const &value) { if (!key.validate()) { throw (new std::runtime_error ( std::string("Invalid UTF-8 in key in ") + std::string(__FUNCTION__))); } if (!value.validate()) { throw (new std::runtime_error ( std::string("Invalid UTF-8 in value in ") + std::string(__FUNCTION__))); } if ( key == "Keywords" && !extras_[key].empty() ) { extras_[key] = extras_[key] + "; " + value; } else { extras_[key] = value; } }
bool is_valid_utf(const Glib::ustring& string) { return string.validate(); }