首页 > 代码库 > UE4中FString转UTF8及UTF8转FString

UE4中FString转UTF8及UTF8转FString

FString转UTF8

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

UTF8转FString

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

 

   

  

UE4中FString转UTF8及UTF8转FString