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).
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 ‘Â’
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?
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