背景
- 网络传输内容, 但是是GB2312编码, 而UE需要UTF-8, UTF-16编码。
解决方案
- 内容GB2312->转码 UTF-8
- 实现测试 源码 如下: (读取本地文件指定编码文件[GB2312/ANSI],解码, 转FString)
UFUNCTION(BlueprintCallable)
static bool ReadRile(const FString& InFilePath, FString& OutContent);
static FString ANSITOUTF_8(const char* ANSI_Str);
/* Win .h*/
#if _WIN32
#include "Windows/AllowWindowsPlatformTypes.h"
#include "stringapiset.h"
#include "Windows/HideWindowsPlatformTypes.h"
#endif
bool UVideoUploadBPLibrary::ReadRile(const FString& InFilePath, FString& OutContent)
{
FString FilePath = InFilePath;
//FilePath = TEXT("E:\\workspace\\py\\Temp\\test4.txt");
// 获取平台文件对象
IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
//