Minecraft mcrcon and iconv for dodgy characters

I was using the mcrcon utility to retrieve performance statistics from a Minecraft server for use in Nagios:

/opt/minecraft/mcrcon -c -H 192.168.1.111 -P 25575 -p “topsecret” list

However the output included dodgy unrecognised � characters (see screenshot).

Selection_198

To remove these characters from the output I converted with iconv to UTF-8 and was then able to use tr to remove the character I didn’t want.

/opt/minecraft/mcrcon -c -H 192.168.1.111 -P 25575 -p “topsecret” list | iconv -f ISO88592 -t UTF8 | tr -d ‘Â’
 

 

2 Responses to “Minecraft mcrcon and iconv for dodgy characters”

  1. Tiiffi

    There are probably some new color codes which aren’t supported by the client yet (or perhaps there is a bug which need to be resolved). What version of the minecraft server you are using?

    Reply
    • jonny

      Since I wrote this I noticed a few other commands giving similar output so it looks to be something to do with the server locale and not mcrcon. I just wanted to make a note of how I got around it in case I needed to do so again – this is obviously not an issue with mcrcon 😉 Thanks.
      I have now tried setting these environment variables:
      export LC_ALL=”en_GB.UTF-8″
      export LANG=”en_GB.UTF-8″
      And add them to the following files too:
      /etc/sysconfig/i18n
      /etc/environment

      Reply

Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">