pterodactyl / panel

Pterodactyl® is a free, open-source game server management panel built with PHP, React, and Go. Designed with security in mind, Pterodactyl runs all game servers in isolated Docker containers while exposing a beautiful and intuitive UI to end users.
https://pterodactyl.io
Other
6.79k stars 1.73k forks source link

Properties Parser Corrupts Emojis and Special Characters #5244

Closed WaDixix closed 1 week ago

WaDixix commented 1 week ago

Current Behavior

When using the properties parser in the wings configuration which is implemented by default on minecraft eggs to enforce certain server variables in server.properties, emojis and special characters in the motd field get corrupted after a server restart.

For instance, if the motd is set to 🔥 §2Welcome§1 to my awesome §bMinecraft Server §b🏴,

it displays correctly until the server is restarted. After the restart, the motd is modified to an escaped Unicode format like: \U0001f525 \u00a72Welcome\u00a71 to my awesome \u00a7bMinecraft Server \u00a7b\U0001f3f4

In Game Render with default pterodactyl parameter ED3AA149-AB22-463A-92F7-99AD58AE030B

after disabling properties parser 4B27F706-4D46-4D80-B3CE-1C77B72408C0

Expected Behavior

The properties parser should retain the original formatting of the parsed file, including emojis and special characters, without converting them to escaped Unicode sequences.

Steps to Reproduce

Edit server.properties and set motd to 🔥 §2Welcome§1 to my awesome §bMinecraft Server §b🏴.

Save the changes and verify the motd appears correctly in the file.

Restart the server.

Reopen server.properties and observe that the motd has been converted to escaped Unicode format.

Panel Version

1.11.9

Wings Version

1.11.13

Games and/or Eggs Affected

not appliable

Docker Image

not appliable

Error Logs

No response

Is there an existing issue for this?

WaDixix commented 1 week ago

I've reviewed the parser code in Wings, and I found that the docblock in the parsePropertiesFile function explicitly addresses this issue. The current behavior—writing UTF-8 values as escaped sequences—is intentional and was implemented to fix earlier bugs where some games had trouble handling raw UTF-8 characters. However, this fix introduced a regression for other games that require unescaped UTF-8 representations.

The docblock mentions that this situation is complex, as balancing the needs of different games and handling UTF-8 sequences correctly without breaking compatibility is challenging. Therefore, this behavior might not be easily changeable or "uncorrectable" without risking further issues for other use cases.