Open NobleDraconian opened 3 years ago
Thanks for the easy repro case! This is really funky; Roblox Studio seems to be producing what looks like standard XML. I'm not sure if it's rbx_xml's interaction with xml-rs that would be broken or if this would be an xml-rs bug. I'll keep poking around and see.
I think it's not a rojo issue :) Usually i create a part in Roblox Studio and save it as *.rbxmx file.
If i put an UTF-8 character into Text Value from Roblox Studio the rbxmx file contains
<string name="Text">♯</string>
.
If i replace the weird string in the *.rbxmx file with an UTF-8 char like
<string name="Text">♫</string>
and delete the part in Roblox Studio, it appears again after sync with the correct value ♫
We're seeing some other escaping issues with our XML library. I'm going to move this issue into rojo-rbx/rbx-dom, as this is where the problem lies. This also impacts Remodel.
Alright, I have bad news. This is Roblox's fault, so our parser being swapped won't fix it and we'll have to do it manually.
The issue lies in that those &#DDD;
character escapes are called "character references" and they explicitly refer to character codepoints, as per the XML standard. So what our parser is doing is expanding them accordingly.
You can actually verify this yourself: 😃
is the byte sequence 240 159 152 131
(in decimal). A quick check will show that's what studio saves too: 😃
. If we were to expand that sequence literally, it would be the correct emoji.
However, that's not what the XML standard says to do, so what we're doing instead is expanding each of those as codepoints. So:
240
becomes U+F0 which expands to c3 b0
159
becomes U+9F which expands to c2 9f
152
becomes U+98 which expands to c2 98
131
becomes U+83 which expands to c2 83
So the total expansion is c3 b0 c2 9f c2 98 c2 83
, which if you look at it in Studio is rather similar to the garbled text in the OP:
We can fix this by escaping characters ourselves, and we likely will. I thought I'd share the fact that this behavior is correct and Roblox is wrong though, since it's interesting.
Currently, as of
6.0.0-rc.1
, any textlabel or other UI element with emoji in them are not created properly with therojo build
command. The resulting text gets garbled, with the emoji being gone.Steps to reproduce
rbxmx
.rojo build
, then open it. Notice the garbled text:rbxmx
from studio. Notice that it displays correctly.