Description
The function BytesToString() does not convert correctly binary array to FString.
It returns the expected value incremented by one. (In this example case char B is returned instead of A)
A ticket was previously created but it was closed as “Won’t Fix”.
Links to previous tickets:
UTF-16 characters return incorrectly from StringToBytes/BytesToString conversion
StringToBytes/BytesToString broken for some characters
Steps to reproduce
-
Open UE4 Editor
-
Add the following code to project anywhere it can be called:
uint8 test[] = { 0b01000001 }; //binary ASCII code representing char A FString conv = BytesToString(test, 1); //conversion resulting as char B UE_LOG(LogTemp, Warning, TEXT("Test: %s"), *conv); //it will print B instead of A
-
Compile
-
Run and check the message log
Result:
“Test: B” is printed
Expected:
“Test: A” should be printed