docker-minecraft-server
                                
                                
                                
                                    docker-minecraft-server copied to clipboard
                            
                            
                            
                        Unicode support in docker attach
Describe the problem
When attached to the server console using docker attach multiple backspace key presses are required to delete non-ascii character.
Example:
- Enter 
тестinto the console, then press backspace 8 times, then enter 'version' and press enter - Do exactly the same thing, but press backspace only 4 times, not 8
 - Enter 
sayinto the console, then enterтестand press backspace 4 times, then entertestand press enter 
Note the misaligned 'vers' happening because of the cursor moving back 8 times.
I am using Putty and Debian for the host, but everywhere else (including docker exec <container> bash) cyrillic characters are handled correctly.
Container definition
Paste run command or compose file here
tty and stdin_open are both set to true
Container logs
Paste logs here
                                    
                                    
                                    
                                
Since you did not provide your container config I cannot confirm how you have TTY or stdin setup. In any case, docker attach is a docker leave mechanism that connects directly to the Minecraft server process. It is beyond the control of the image to further influence that.
...one thing you could try it setting the env variable EXEC_DIRECTLY to "true". The server may no longer stop gracefully, but that'll eliminate any possible interference in the console attachment.
EXEC_DIRECTLY: 'true' does fix the issue.
I mentioned tty and stdin in the original message, but here is the full container config:
version: "3"
services:
  server0:
    image: itzg/minecraft-server:latest
    ports:
      - 25565:25565
      - 25575:25575
    environment:
      EULA: "TRUE"
      TYPE: 'PAPER'
      ICON: <redacted>
      OVERRIDE_ICON: 'TRUE'
      VERSION: '1.20.1'
      DIFFICULTY: 'hard'
      USE_AIKAR_FLAGS: 'true'
      MEMORY: '6G'
      SNOOPER_ENABLED: 'false'
      SERVER_NAME: <redacted>
      RCON_PASSWORD: <redacted>
      MODRINTH_DOWNLOAD_OPTIONAL_DEPENDENCIES: 'false'
      MODRINTH_ALLOWED_VERSION_TYPE: 'beta'
      DATAPACKS: 'https://static.planetminecraft.com/files/resource_media/datapack/global-trades-e2450.zip'
      EXEC_DIRECTLY: 'true' # added this line as per your suggestion
    tty: true
    stdin_open: true
    volumes:
      - /home/fxserver/minecraft-server/server0/data:/data
      - /home/fxserver/minecraft-server/server0/plugins:/plugins
      - /home/fxserver/minecraft-server/server0/mods:/mods
      - /home/fxserver/minecraft-server/server0/config:/config
                                    
                                    
                                    
                                
Reproduced with minimal setup:
version: "3"
services:
  server0:
    image: itzg/minecraft-server:latest
    environment:
      EULA: "TRUE"
      #EXEC_DIRECTLY: 'true'
    tty: true
    stdin_open: true
With EXEC_DIRECTLY: 'true' everything works fine, without the setting the issue is reproduced.
I believe this issue comes from the mc-server-runner proxying the java process's stdin/stdout.
I investigated the code, but due to my lack of Golang background, my further investigation yielded no results.
Thanks, yes, I realized later it was probably that. I'll need to research how to directly associate the stdin/out rather than relaying the content between them.