base100 icon indicating copy to clipboard operation
base100 copied to clipboard

index out of bounds: the len is 1 but the index is 2 when trying to decode

Open ignatenkobrain opened this issue 6 years ago • 6 comments

[brain@ignatenko-w541 ~]$ echo "👟👜👣👣👦🐁" | base100 -d
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 2', src/main.rs:91:20
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Aborted (core dumped)

ignatenkobrain avatar Feb 14 '18 17:02 ignatenkobrain

weird enough when doing echo hello | base100 | base100 -d, everything works fine

ignatenkobrain avatar Feb 14 '18 17:02 ignatenkobrain

Try echo -n "👟👜👣👣👦🐁". The newline at the end is probably causing the panic, because it's only one byte instead of four.

AdamNiederer avatar Feb 14 '18 17:02 AdamNiederer

Oh, that worked. Is there any way we can make newline to work? Also in output too.

ignatenkobrain avatar Feb 14 '18 17:02 ignatenkobrain

Yeah, I can strip a newline off of the input and add one to the output. I'll have that in the next release.

AdamNiederer avatar Feb 14 '18 17:02 AdamNiederer

Any news on this issue? I'm using "base100 --decode {path_to_file}" in my script, so I guess "echo -n" is not available for me. Is there an another workaround?

MasterGroosha avatar May 10 '19 23:05 MasterGroosha

echo "Hallo Tristan wie geht es dir?" | base100 > out.txt cat out.txt | base100 -d this way it works

0xpr03 avatar Jul 09 '19 07:07 0xpr03