Expressive output adds U+a0 character to spaces when printing tables

Issue Type: Other
Impact: Moderate
Frequency: Constantly
Date First Experienced: 2021-03-04 18:03:00 (-08:00)
Date Last Experienced: 2021-03-04 18:03:00 (-08:00)

Reproduction Steps:
Print a table with enough room for you to copy from.

local p = Instance.new("Part")
p.Parent = workspace
for i = 1, 10 do
    p:SetAttribute("Attr" .. i, i^2)
end
print(p:GetAttributes())

Copy the code, then paste it into a script. You will see this error:

image

Expected Behavior:
I expect for there to not be any special Unicode characters anywhere. I also expect the key-value pairs to be indented using tabs, not spaces. Or at least respecting the Indent Using Space setting, so it would use spaces if it were checked, tabs otherwise.

Actual Behavior:
Unicode character U+a0 gets added within the spaces.

Workaround:
Writing it out myself or using a custom function that pretty-prints tables.

1 Like

U+a0 is a no-break space (Unicode Character 'NO-BREAK SPACE' (U+00A0))

Looks to me like this is a syntax error with your code, not expressive output adding extra characters:

for  i = 1, 10 do

Seems like you’ve added two spaces after the for.

I wouldn’t randomly have that character pop up in my code.

It still comes up.

Ah, you’re correct. It seems to me that this is a consequence of the formatting used on tables. I copied the output and converted it to hexadecimal Unicode codepoints:

20 7b a a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 5b 22 61 22 5d 20 3d 20 31 2c a a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 5b 22 62 22 5d 20 3d 20 32 2c a a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 5b 22 63 22 5d 20 3d 20 33 a a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 a0 7d

Seems to me like they are using a couple no-break spaces in place of tabs - you can tell just by highlighting the output that these aren’t real tabs.

QJOw09FMgX

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

2 Likes

It doesn’t even have to be a table, printing anything will print two u+a0 characters then the text.

While I’m not in a rush to use it, I wrote a bit of code that copies the data of all parts of a specified model and prints the code needed to generate those parts via script. This removes the need to have the model in the game at all as the code will create it from nothing.

Using ctrl+f to replace those characters doesn’t work either, and I made sure to copy the characters to the search bar.

2 Likes

This issue should now be resolved! If this issue is still occurring, please create a new topic for us to look into.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.