Escape characters printing in text labels

I have this string:

"hi \" \\"

and in a textlabel it looks like this:

I just tested it, and it works as it should for me, which makes it even weirder. I even copied the string you provided at beginning, and it worked fine.

did you paste it into a TextBox or TextLabel? I said TextBox above but I meant TextLabel.

I have some new info: I used my twitter script and used the string from the twitter feed, and this is what appeared:

I guess a way to fix the & would be to unescape HTML encoding.

Lemme find a script which does that, now.

EDIT: Here we go. I’ve gotten it from the LuaSocket url unescape function, which converts escaped characters into their actual format. This is for url unescaping, I’ll find a html unescape now.

function unescape(s)
    return string.gsub(s, "%%(%x%x)", function(hex)
        return string.char(base.tonumber(hex, 16))
    end)
end

EDIT2: Here we go, found one from stackoverflow. This should work for the most part.

local gsub, char = string.gsub, string.char
local entityMap  = {["lt"]="<",["gt"]=">",["amp"]="&",["quot"]='"',["apos"]="'"}
local entitySwap = function(orig,n,s)
  return entityMap[s] or n=="#" and char(s) or orig
end
function unescape(str)
  return gsub( str, '(&(#?)([%d%a]+);)', entitySwap )
end

Both of these GuiObject instances display text in the same manner, so that wouldn’t cause an issue. You likely have a malformed string which hasn’t been opened/closed correctly and/or is using both single/double quotes causing this to occur.