Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-2215

Encoding errors in server.properties

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.4.2, Minecraft 1.4.3, Minecraft 1.4.4, Minecraft 1.4.7, Minecraft 1.5, Minecraft 1.6.2, Minecraft 1.6.4, Minecraft 1.7.1, Minecraft 1.7.2, Minecraft 1.7.4, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.8, Minecraft 15w49b, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a, Minecraft 1.11.2, Minecraft 1.12.2, Minecraft 18w16a, Minecraft 1.13.1, 1.14.4
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      The server.properties file doesn't seems to handle unicode UTF-8 correctly, while still trying to recode it as such. This is most apparent on motd where you can't type non-ascii characters and save it as UTF-8.

      For example if trying to change motd to "motd=§lA Minecraft Server", when the server starts, the properties file change it into "motd=\u00C2\u00A7lA Minecraft Server" and the multiplayer screen shows gibberish.

      You can though somehow overcome this by encode the file as latin1 (iso-8859-1). While the server.properties still gets changed into "motd=\u00A7lA Minecraft Server", at least it shows up correctly in the multiplayer list.

      This happens off course for all non-ascii characters, like ß, Å, etc.

      Cause and suggested fix from Orthotope:

      Looking at the code, the problem here is the use of the java.util.Properties.load(InputStream) and Properties.store(OutputStream, String) methods. Both of these assume the use of ISO 8859-1 encoding, and this cannot be changed. The solution is to use the Properties.load(Reader) and Properties.store(Writer, String) methods instead; InputStreamReader and OutputStreamWriter can be used to wrap the FileInputStream and FileOutputStream respectively and specify the UTF-8 charset.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              azatoth Carl Fürstenberg
            • Votes:
              21 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: