Outputs in Studio containing null bytes does not match LogService.MessageOut message argument

In Studio (and in Studio only; this does not happen in the actual in-game client possibly due to varying handling), creating an output using print or warn (or error but havent tested) that contains a null byte, eg.

print("Hello,\0 world!")

everything after “Hello,” is visible in the Studio output, but not in DevConsole or the message argument in LogService.
Here is an example that shows both the Studio output and DevConsole, demonstrating the visual difference:


Second example:

Interestingly enough, when calling game:GetService("LogService"):GetLogHistory() this does not apply to the .message argument:

While LogService.MessageOut contains the version of the string where the null byte and anything after it does not exist, LogService:GetLogHistory() shows you the entirety of the string, including the null byte and everything after.

Code used in Studio:

local Connection; Connection = game:GetService("LogService").MessageOut:Connect(function(Msg)
	print("Output message:", Msg)
	print("Contains null byte:", Msg:find("\0") ~= nil)
	
	-- since MessageOut seemingly fires the frame after an output the positioning of this
	-- doesnt matter that much since it wont repetitively fire itself regardless
	Connection:Disconnect()
	Connection = nil
end)

task.wait(1) -- ReplicatedFirst is unfavorable it seems, or something else, idk, not concern of bug report
print("Hello, world!\0 Any text after the Hello, world! is only visible in the Studio output")

-- not in the original code but it is a good comparison snippet of code to show the difference of MessageOut and GetLogHistory
--print("Null byte in GetLogHistory version:", game:GetService("LogService"):GetLogHistory()[1]:find("\0") ~= nil)

FYI obviously this happens 100% of the time, and SHOULD happen on every device. The Studio output handler may differ between Mac and Windows, however the results of MessageOut and GetLogHistory SHOULD be universal across every device.

Place for testing:
OutputDemo.rbxl (56.8 KB)

Expected behavior

I expect that either the LogService.MessageOut message argument returns every part of the message, including what is after the null byte, or that the Studio output and LogService:GetLogHistory() automatically removes the null byte and whatever comes after it.

1 Like