tier1/strtools.cpp
int _V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInBytes )
{
	Assert( cubDestSizeInBytes >= sizeof( *pwchDest ) );
	pwchDest[0] = 0;
	if ( !pUTF8 )
		return 0;
#ifdef _WIN32
	int cchResult = MultiByteToWideChar( CP_UTF8, 0, pUTF8, -1, pwchDest, cubDestSizeInBytes / sizeof(wchar_t) );
#elif POSIX
	int cchResult = mbstowcs( pwchDest, pUTF8, cubDestSizeInBytes / sizeof(wchar_t) );
#endif
	pwchDest[(cubDestSizeInBytes / sizeof(wchar_t)) - 1] = 0;
	return cchResult;
}
//-----------------------------------------------------------------------------
// Purpose: Converts a UTF8 string into a unicode string
//-----------------------------------------------------------------------------
Converts a UTF8 string into a unicode string
Converts a UTF8 string into a unicode string
int _V_UTF8ToUnicode( const char *pUTF8, wchar_t *pwchDest, int cubDestSizeInBytes )
{
	Assert( cubDestSizeInBytes >= sizeof( *pwchDest ) );
	pwchDest[0] = 0;
	if ( !pUTF8 )
		return 0;
#ifdef _WIN32
	int cchResult = MultiByteToWideChar( CP_UTF8, 0, pUTF8, -1, pwchDest, cubDestSizeInBytes / sizeof(wchar_t) );
#elif POSIX
	int cchResult = mbstowcs( pwchDest, pUTF8, cubDestSizeInBytes / sizeof(wchar_t) );
#endif
	pwchDest[(cubDestSizeInBytes / sizeof(wchar_t)) - 1] = 0;
	return cchResult;
}
int _V_UTF8ToUnicode ( const char * pUTF8 , wchar_t * pwchDest , int cubDestSizeInBytes ) { Assert ( cubDestSizeInBytes >= sizeof ( * pwchDest ) ) ; pwchDest [ 0 ] = 0 ; if ( ! pUTF8 ) return 0 ; #ifdef _WIN32 int cchResult = MultiByteToWideChar ( CP_UTF8 , 0 , pUTF8 , -1 , pwchDest , cubDestSizeInBytes / sizeof ( wchar_t ) ) ; #elif POSIX int cchResult = mbstowcs ( pwchDest , pUTF8 , cubDestSizeInBytes / sizeof ( wchar_t ) ) ; #endif pwchDest [ ( cubDestSizeInBytes / sizeof ( wchar_t ) ) - 1 ] = 0 ; return cchResult ; }
Purpose: Converts a UTF8 string into a unicode string
Purpose : Converts a UTF8 string into a unicode string