Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-1220

Query: utf-8 players' names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • None
    • Does not matter.

      Steps to reproduce:
      1. Switch "enable-query" to true, "online-mode" to false
      2. Start the server.
      3. Log in under some non-ASCII name, for example "игрок" (non-official launcher).
      4. Connect to server, it will handle your name correctly as any other utf-8 name.
      5. Query the server, for example, with PHP-Source-Query (https://github.com/xPaw/PHP-Source-Query).
      6. Discover that instead "игрок" server query says that there is a player with some strange nick like "B3J@U".
      ================
      Expected output:
      Server query returns "игрок"
      ================
      Real output:
      Server query returns "B3J@U"
      ================
      Explanation:
      There is a class net.minecraft.server.v1_8_R3.RemoteStatusListener. A method "private byte[] b(DatagramPacket var1)" is responsible for forming return string for query. There are strings "
      for(String p: this.b.getPlayers())

      { this.v.a(p); }

      ", responsible for forming player list. "this.v.a(String str)" leads to "this.stream.writeBytes(b);" what leads to function contains "out.write((byte)s.charAt)". But not all chars can be converted to byte without losses! Some, non-ASCII, are losing senior bits what leads to unrecoverable data loss.
      ================
      Fix:
      Replace "this.v.a(p);" to "this.v.a(p.getBytes(Charset.forName("UTF-8")));this.v.a("");" in net.minecraft.server.v1_8_R3.RemoteStatusListener class.
      After that RemoteStatusListener handles utf-8 players' names correctly. Tested, works.
      ================
      It is expected that new patch will be added to the SPIGOT project.

            Unassigned Unassigned
            gr00t  
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: