Cita:
Empezado por b4aronDeLaBirr4
¿Y en qué consiste esa función de conversión?
|
Código:
std::string cdfCodificarUtf8(const char *txt)
{
int lnga=MultiByteToWideChar(CP_ACP,0,txt,-1,nullptr,0);
WCHAR *tmpa=new WCHAR[lnga];
MultiByteToWideChar(CP_ACP,0,txt,-1,tmpa,lnga);
int lngb=WideCharToMultiByte(CP_UTF8,0,tmpa,-1,nullptr,0,nullptr,nullptr);
char *tmpb=new char[lngb];
WideCharToMultiByte(CP_UTF8,0,tmpa,-1,tmpb,lngb,nullptr,nullptr);
std::string dst=tmpb;
delete tmpa;
delete tmpb;
return(dst);
}