Developer Notes

This issue has been closed as 'Won't Fix' due to an extended period of time without updates. If this issue is important to you please let us know by posting on the AnswerHub or UDN, and Epic will re-open the ticket for further review.

Description

When a UTF-16 character (™ for example) is passed into a StringToBytes() function and then returned via BytesToString, the returned character does not match (in the case of ™, a double quotes is returned instead).

Steps to Reproduce
  1. Open UE4 Editor
  2. Add code to project based on Actor (MyActor)
  3. In MyActor::BeginPlay() add the following:
    	FString inString(TEXT("™"));
    	uint32 size = inString.Len();
    	TArray<uint8> data;
    	data.AddUninitialized(size);
    	StringToBytes(inString, data.GetData(), size);
    
    	FString outString = BytesToString(data.GetData(), size);
    
    	GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, inString);
    	GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Green, outString);
    
  4. Compile
  5. Add instance of class to the level
  6. PIE

Result:
™ is printed as the inString and " is printed as the outString

Expected:
™ is returned for both the inString and outString.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

11
Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.12.5
CreatedJul 28, 2016
ResolvedMar 26, 2018
UpdatedApr 27, 2018
View Jira Issue