예제 #1
0
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);
}
예제 #2
0
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;
	}
}
예제 #3
0
bool is_valid_utf(const Glib::ustring& string)
{
	return string.validate();
}