All pastes #277573 Raw Edit

adhawkins

public text v1 · immutable
·published 2006-12-13 10:35 UTC
rendered paste body
	char *In=new char[m_Albums[Line].Name().length()+1];
	char *Out=new char[m_Albums[Line].Name().length()*2];
	size_t InLeft=m_Albums[Line].Name().length();
	size_t OutLeft=m_Albums[Line].Name().length()*2;
	char *InBuff=In;
	char *OutBuff=Out;
	
	iconv_t Convert=iconv_open("ISO-8859-1","UTF-8");
	if (Convert!=(iconv_t)-1)
	{
		size_t Converted=iconv(Convert,&InBuff,&InLeft,&OutBuff,&OutLeft);
		if (Converted==(size_t)-1)
			perror("iconv");
		else
			CErrorLog::Log(Out);
		
		iconv_close(Convert);
	}

	if (In)
		free(In);
		
	if (Out)
		free(Out);