[英]Everytime I build a unreal engine project, vs keeps warning like this: unable to get MBCS string
2> --------------------Project: Default-------------------------------------------
2> MyProjectCharacter.cpp (0:01.59 at +0:00)
2> EXEC : warning : unable to get MBCS string (input text '??: ?? ??:%s%s
2> ', library C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\1042\clui.dll)
2> UE4Editor-MyProject-0002.dll (0:00.68 at +0:01)
2> Creating library C:\Users\grand\GameDev\MyProject\Intermediate\Build\Win64\UE4Editor\Development\MyProject\UE4Editor-MyProject-0002.suppressed.lib and object C:\Users\grand\GameDev\MyProject\Intermediate\Build\Win64\UE4Editor\Development\MyProject\UE4Editor-MyProject-0002.suppressed.exp
2> UE4Editor-MyProject-0002.lib (0:00.07 at +0:02)
2> Creating library C:\Users\grand\GameDev\MyProject\Intermediate\Build\Win64\UE4Editor\Development\MyProject\UE4Editor-MyProject-0002.lib and object C:\Users\grand\GameDev\MyProject\Intermediate\Build\Win64\UE4Editor\Development\MyProject\UE4Editor-MyProject-0002.exp
2> MyProjectEditor.target (0:00.17 at +0:02)
2> ---------------------- Done ----------------------
There's no problem with compiling, but this warning keeps showing up on the output window.编译没有问题,但是这个警告一直出现在 output window 上。 Is this just a trivial thing that has nothing to do with the game I'm making?
这只是一件与我正在制作的游戏无关的小事吗? or can it make some problems later?
还是以后会出问题? I googled this warning, but nothing I can find.
我用谷歌搜索了这个警告,但我找不到任何东西。 What I did to solve it is downgrading engine version to 4.24, reinstalling VS and UE4, installing MSVC v141, v140(verion 2017, 2015).
我为解决它所做的是将引擎版本降级到 4.24,重新安装 VS 和 UE4,安装 MSVC v141、v140(版本 2017、2015)。
This is sample from UE4 Internal String Representation这是来自UE4 内部字符串表示的示例
UE4 Internal String Representation: All strings in Unreal Engine 4 (UE4) are stored in memory in UTF-16 format as FStrings or TCHAR arrays. UE4 内部字符串表示:虚幻引擎 4 (UE4) 中的所有字符串都以 UTF-16 格式作为 FStrings 或 TCHAR arrays 存储在 memory 中。 Most code assumes 2 bytes is one codepoint so only the Basic Multilingual Plane (BMP) is supported so Unreal's internal encoding is more correctly described as UCS-2.
大多数代码假定 2 个字节是一个代码点,因此仅支持基本多语言平面 (BMP),因此 Unreal 的内部编码更准确地描述为 UCS-2。 Strings are stored in the endian-ness appropriate for the current platform.
字符串以适合当前平台的字节序存储。 When serializing to packages to/from disk or during networking, strings with all TCHAR characters less than 0xff are stored as a series of 8-bit bytes, and otherwise as 2-byte UTF-16 strings.
在将包序列化到磁盘/从磁盘或网络期间,所有 TCHAR 字符小于 0xff 的字符串存储为一系列 8 位字节,否则存储为 2 字节 UTF-16 字符串。 The serialization code can deal with any endian conversion as necessary.
序列化代码可以根据需要处理任何字节序转换。 When Unreal loads an external text file (for example reading a.INT file at runtime) it is almost always done with the appLoadFileToString() function found in UnMisc.cpp.
当 Unreal 加载一个外部文本文件(例如在运行时读取一个 .INT 文件)时,几乎总是使用 UnMisc.cpp 中的 appLoadFileToString() function 来完成。 The main work occurs in the appBufferToString() function.
主要工作发生在 appBufferToString() function 中。 This function recognizes the Unicode byte-order-mark (BOM) in a UTF-16 file and if present, will load the file as UTF-16 in either endian-ness.
此 function 可识别 UTF-16 文件中的 Unicode 字节顺序标记 (BOM),如果存在,将以任一字节顺序将文件加载为 UTF-16。 What happens when the BOM is not present depends on the platform.
当 BOM 不存在时会发生什么取决于平台。 On Windows, it will attempt to convert the text to UTF-16 using the default Windows MBCS encoding (eg
Windows-1252 for US English and Western Europe, CP949 for Korean and CP932 for Japanese
) and uses MultiByteToWideChar
(CP_ACP, MB_ERR_INVALID_CHARS...).在 Windows 上,它将尝试使用默认的 Windows MBCS 编码将文本转换为 UTF-16(例如
Windows-1252 for US English and Western Europe, CP949 for Korean and CP932 for Japanese
)并使用MultiByteToWideChar
(CP_SIN... )。 This was added around the July 2009 QA build.这是在 2009 年 7 月的 QA 版本中添加的。 If this conversion fails on platforms other than Windows, it will just read each byte and pad it to 16-bits to make an array of TCHARs.
如果此转换在 Windows 以外的平台上失败,它将仅读取每个字节并将其填充到 16 位以生成 TCHAR 数组。 Note that there is no code to detect or decode UTF-8 encoded text files loaded with appLoadFileToString().
请注意,没有代码可以检测或解码使用 appLoadFileToString() 加载的 UTF-8 编码文本文件。
It seems your program faces a language unicode warning conversion.看来您的程序面临语言 unicode 警告转换。 If your read or converted string is correct with your language settings, then you can ignore this Warning.
如果您读取或转换的字符串在您的语言设置中是正确的,那么您可以忽略此警告。 But try some conversion with all your language characters to checks if all are well converted.
但是尝试对所有语言字符进行一些转换,以检查是否都转换得很好。 Otherwise, your can force language conversion using:
否则,您可以使用以下命令强制进行语言转换:
string utf8String = Encoding.UTF8.GetString(Encoding.ASCII.GetBytes(text));
Take also a look at this SO question: How to convert Unicode string to a TCHAR system with Unreal project也看看这个 SO 问题: How to convert Unicode string to a TCHAR system with Unreal project
Wow it was because of IncreBuild.哇,这是因为 IncreBuild。 I deleted it, and the warning doesn't come out anymore.
我删除了它,警告不再出现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.