FString not work well when containing Chinese characters

I defined a function in my c++ class
FString UMyBlueprintFunctionLibrary::TestFString()
FString m = “你”;
return m;
Then I call this function in blueprint,and print the return value.It prints ?? rather than “你”.

This string literal you are passing cannot properly hold Chinese characters.


You need to have the literal converted to wide characters otherwise it will try to parse it as a pure ansi string which will be invalid.

EDIT: so with an example:

FString m = TEXT(“你”);

FString UMyBlueprintFunctionLibrary::TestFString(FString m)
return m;
If I call this function in blueprint and set the parameter of m as “你”,and print the return value.It prints ?? rather than “你”. How can i solve this problem?


I think the FString data type can only contain ASCII / ASCI characters. You might need to do some encoding to produce the correct character type.

This document might help:

  • Paradox