Roblox chat script errors with "invalid UTF-8" error

Reproduction Steps

I have been unable to reproduce the issue, but rather have gotten logged errors containing information about this. The error stems from the sent message containing an invalid UTF-8 character, though pasting in different unicode characters has not allowed me to reproduce the error.

The error message is as follows:

Players.[PlayerName].PlayerScripts.ChatScript.ChatMain.ChatBar:192: String contains invalid UTF-8
File “Players.[PlayerName].PlayerScripts.ChatScript.ChatMain.ChatBar” line 192

The error line points to the following line:

if utf8.len(utf8.nfcnormalize(TextBox.Text)) > ChatSettings.MaximumMessageLength then

I was able to reproduce the exact same error through the following code:

utf8.len(utf8.nfcnormalize("\200a"))

Expected Behavior

The chat bar should not error when inputted with invalid UTF-8, and should either silently absorb the error or process it into a valid format.

Actual Behavior

The chat bar errors when invalid UTF-8 is received, and fills up the error console (and thus our logging site) with an error which we cannot fix.

Workaround

Hardcode a check to ignore any errors from the chat bar script.

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Sometimes

10 Likes

Thanks for the report! We’ll investigate.

7 Likes

Can confirm with this, getting a large chunk of errors with this. And is also fairly common.

4 Likes

My game that receives ~8,000 visits a day has this error ~250 times per day. Typically this error happens with the same user multiple times in quick succession (anywhere from 2 to 50 times). Although I’m also uncertain the cause or the impact it may have to any affected users

2 Likes

This error has been around for a while, it happens while typing in chat on a mobile device. Many times when i hit enter to send a message, it just closes the keyboard without sending the message. This also happens while typing in dev console, its very annoying to open my keyboard and hit enter multiple times just to send a message.

3 Likes

This is still happening, is there an update on this?

3 Likes


using the new error analytics, this is just in 1 day

5 Likes

Still happening here too, very annoying when trying to talk fast

This has been happening for months, even before the script error analytics.

1 Like

This is the top error in my game, but I am going to switch to TextChatService soon.

An update on this would be awesome! I’m having this problem with a few players in my games, it’s really annoying since we use chat-based command triggers and this error makes them unable to activate the triggers.

1 Like

Bump… how is this still an error!? :slight_smile:

2 Likes

Somebody could make a fix by forking the chat to pcall that but we shouldn’t have to use workarounds

1 Like

We won’t be fixing this since this is an issue for chats using the Legacy Chat System. We recommend migrating to TextChatService. All in-experience chats will need to use TextChatService by April 30th, 2025 as well.

2 Likes

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