예제 #1
0
bool http_pipe::set_charset(const char* from, const char* to)
{
	if (from == NULL || to == NULL || strcasecmp(from, to) == 0)
		return false;
	if (conv_ == NULL)
		conv_ = NEW charset_conv();
	if (conv_->update_begin(from, to) == false)
	{
		delete conv_;
		conv_ = NULL;
		return false;
	}
	set_charset(conv_);
	return true;
}
예제 #2
0
// 获得字符集转换器
charset_conv* charset_conv::create(const char* fromCharset,
	const char* toCharset)
{
	if (fromCharset == NULL || toCharset == NULL)
		return (NULL);
	if (strcasecmp(fromCharset, toCharset) == 0)
		return (NULL);

	charset_conv* conv = NEW charset_conv();
	if (conv->update_begin(fromCharset, toCharset) == false)
	{
		delete conv;
		return (NULL);
	}
	return (conv);
}