UE4中FString转UTF8及UTF8转FString

FString转UTF8

1 FString szMsg = "test msg";
2 TCHAR* pSendData = szMsg.GetCharArray().GetData();
3 int32 nDataLen = FCString::Strlen(pSendData);
4 uint8* dst = (uint8*)TCHAR_TO_UTF8(pSendData);

UTF8转FString

1  TArray receiveBuff;
2  RecvData(receiveBuff, buffLen));    
3    receiveBuff.Add('\0');
4    FString str = FString(reinterpret_cast<const char*>(receiveBuff.GetData()));

 

   

  

转载于:https://www.cnblogs.com/DeepFlavor/p/6236410.html

你可能感兴趣的:(UE4中FString转UTF8及UTF8转FString)