mqtt-cli icon indicating copy to clipboard operation
mqtt-cli copied to clipboard

Windows Command Line Verbiage Gibberish

Open Sn3akyP3t3 opened this issue 2 years ago • 3 comments

Expected behavior

Clean readable verbiage from the command line. This includes any --help commands.

Actual behavior

Run mqtt-cli.exe and get this.

C:\Users\User\Downloads\mqtt-cli-4.7.3-win>mqtt-cli.exe

←[1mUsage:←[21m←[0m  ←[1m←[33mmqtt←[39m←[21m←[0m [←[3m←[33m-hV←[39m←[23m←[0m] { pub | sub | shell | test | hivemq }

MQTT Command Line Interpreter.

←[1mOptions:←[21m←[0m
  ←[3m←[33m-h←[39m←[23m←[0m, ←[3m←[33m--help←[39m←[23m←[0m      Show this help message and exit.
  ←[3m←[33m-V←[39m←[23m←[0m, ←[3m←[33m--version←[39m←[23m←[0m   Print version information and exit.

←[1mCommands:←[21m←[0m
  ←[1m←[33mpub←[39m←[21m←[0m, ←[1m←[33mpublish←[39m←[21m←[0m    Publish a message to a list of topics.
  ←[1m←[33msub←[39m←[21m←[0m, ←[1m←[33msubscribe←[39m←[21m←[0m  Subscribe an MQTT client to a list of topics.
  ←[1m←[33mshell←[39m←[21m←[0m, ←[1m←[33msh←[39m←[21m←[0m       Starts MqttCLI in shell mode, to enable interactive mode with further sub commands.
  ←[1m←[33mtest←[39m←[21m←[0m            Tests the specified broker on different MQTT feature support and prints the results
  ←[1m←[33mhivemq←[39m←[21m←[0m          HiveMQ Command Line Interpreter.
  ←[1m←[33mswarm←[39m←[21m←[0m           HiveMQ Swarm Command Line Interpreter.

To Reproduce

Steps

Not really sure. All I did was ran mqtt-cli-4.7.3-win (also mqtt-cli-4.7.5-win) executable mqtt-cli.exe and it gives the gibberish.

Reproducer code

Details

  • Affected MQTT CLI version(s): mqtt-cli-4.7.3-win (also mqtt-cli-4.7.5-win) for sure. I didn't check others.
  • Used JVM version:
java --version
openjdk 11.0.12 2021-07-20
OpenJDK Runtime Environment Microsoft-25199 (build 11.0.12+7)
OpenJDK 64-Bit Server VM Microsoft-25199 (build 11.0.12+7, mixed mode)

Sn3akyP3t3 avatar Mar 23 '22 19:03 Sn3akyP3t3

I got the same output as above.

I installed mqtt-cli version 4.8.2-win and os is win11.
Java version: openjdk 16.0.2 2021-07-20 OpenJDK Runtime Environment Temurin-16.0.2+7 (build 16.0.2+7) OpenJDK 64-Bit Server VM Temurin-16.0.2+7 (build 16.0.2+7, mixed mode, sharing)

edge-ai4cv avatar Jul 02 '22 22:07 edge-ai4cv

does the issue persist when you reset your terminal to use utf8 encoding?

how to do that

on windows the command is described here, though if you are not on powershell, you will probably have to type chcp then press <Tab> to see the right completion (maybe .com? - dont remember off hand), and then a space, followed by the unicode code 65001. on powershell, chcp 65001 should work.

alexanderankin avatar Jul 22 '22 17:07 alexanderankin

@alexanderankin Gave it a shot with PowerShell and got different results. Looks to be similar, but with a different character set.

PS C:\Users\User\Downloads\mqtt-cli-4.7.3-win> chcp 65001
Active code page: 65001
PS C:\Users\User\Downloads\mqtt-cli-4.7.3-win> .\mqtt-cli.exe

[1mUsage:[21m[0m  [1m[33mmqtt[39m[21m[0m [[3m[33m-hV[39m[23m[0m] { pub | sub | shell | test | hivemq }

MQTT Command Line Interpreter.

[1mOptions:[21m[0m
  [3m[33m-h[39m[23m[0m, [3m[33m--help[39m[23m[0m      Show this help message and exit.
  [3m[33m-V[39m[23m[0m, [3m[33m--version[39m[23m[0m   Print version information and exit.

[1mCommands:[21m[0m
  [1m[33mpub[39m[21m[0m, [1m[33mpublish[39m[21m[0m    Publish a message to a list of topics.
  [1m[33msub[39m[21m[0m, [1m[33msubscribe[39m[21m[0m  Subscribe an MQTT client to a list of topics.
  [1m[33mshell[39m[21m[0m, [1m[33msh[39m[21m[0m       Starts MqttCLI in shell mode, to enable interactive mode with further sub commands.
  [1m[33mtest[39m[21m[0m            Tests the specified broker on different MQTT feature support and prints the results
  [1m[33mhivemq[39m[21m[0m          HiveMQ Command Line Interpreter.
  [1m[33mswarm[39m[21m[0m           HiveMQ Swarm Command Line Interpreter.

However, if I right click on the folder (Explorer) and then select the option to "Open In Terminal" it opens up a PowerShell terminal and there's zero gibberish output when running it from that perspective. I have no idea what is different with the terminal offered in that way then what PowerShell or CMD.exe are doing on their own.

Sn3akyP3t3 avatar Jul 26 '22 22:07 Sn3akyP3t3