LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   whitespace character from base64 decode (https://www.linuxquestions.org/questions/linux-software-2/whitespace-character-from-base64-decode-4175453271/)

kptkill 03-08-2013 09:18 AM

whitespace character from base64 decode
 
Hello All,

I'm getting an unexpected white space character when I run the following command:
echo "FglqZmpvLjo="|openssl base64 -d

Code:

"        jfjo.:"  (no quotes)
However, running that string back though base64 does not return the same value.
If I run this:echo "FglqZmpvLjo="|openssl base64 -d > temp.txt
and open in vim, I see
Code:

"^V      jfjo.:"  Again no quotes
Can anyone explain this issue?

Thanks!

shivaa 03-08-2013 10:54 AM

What output you want? Do you want ("} symbol to be printed?

kptkill 03-08-2013 11:36 AM

The question is why is it outputting that whitespace? its not a space, its not a tab... I don't know what "^V " is. The true reason is this is only part of a script. Each character is then inputed into a for loop. obviously, the for loop doesn't like the whitespace as I've coded it, but I can't work around the problem without knowing what character it is outputting.

According to Wikipedia, ^V is a Synchronous idle. I'm not understanding.

ntubski 03-08-2013 12:34 PM

Quote:

Originally Posted by kptkill (Post 4907513)
The question is why is it outputting that whitespace?...

That is what is encoded by the input "FglqZmpvLjo=". It's really a non-printable byte, not whitespace. That's why if you just look at the output in the terminal it seems like the ^V byte is not there.

Quote:

According to Wikipedia, ^V is a Synchronous idle. I'm not understanding.
That name refers to old systems that used this byte in a certain way; you should simply consider it a byte with value 22.

Quote:

The true reason is this is only part of a script. Each character is then inputed into a for loop. obviously, the for loop doesn't like the whitespace as I've coded it, but I can't work around the problem without knowing what character it is outputting.
Actually, you can code your script such that it can handle any input (except for 0 (aka NUL) bytes) by quoting properly.


All times are GMT -5. The time now is 02:28 AM.