Open
Description
Describe the bug
The output of jq's @base64d does not match the output of base64 -d
for the same string
To Reproduce
$ echo "V0MsL2hwbyCcGs2AMrFAKaSjPl8OuX4OWAEip+idGVU=" | jq -Rr '@base64d' | xxd -p -c64
57432c2f68706f20efbfbd1acd8032efbfbd4029efbfbdefbfbd3e5f0eefbfbd7e0e580122efbfbdefbfbd19550a
$ echo "V0MsL2hwbyCcGs2AMrFAKaSjPl8OuX4OWAEip+idGVU=" | base64 -d | xxd -p -c64
57432c2f68706f209c1acd8032b14029a4a33e5f0eb97e0e580122a7e89d1955
$ echo "V0MsL2hwbyCcGs2AMrFAKaSjPl8OuX4OWAEip+idGVU=" | base64 -d | hexdump -C
00000000 57 43 2c 2f 68 70 6f 20 9c 1a cd 80 32 b1 40 29 |WC,/hpo ....2.@)|
00000010 a4 a3 3e 5f 0e b9 7e 0e 58 01 22 a7 e8 9d 19 55 |..>_..~.X."....U|
$ echo "V0MsL2hwbyCcGs2AMrFAKaSjPl8OuX4OWAEip+idGVU=" | jq -Rr '@base64d' | hexdump -C
00000000 57 43 2c 2f 68 70 6f 20 ef bf bd 1a cd 80 32 ef |WC,/hpo ......2.|
00000010 bf bd 40 29 ef bf bd ef bf bd 3e 5f 0e ef bf bd |..@)......>_....|
00000020 7e 0e 58 01 22 ef bf bd ef bf bd 19 55 0a |~.X.".......U.|
Expected behavior
The outputs of echo "V0MsL2hwbyCcGs2AMrFAKaSjPl8OuX4OWAEip+idGVU=" | jq -Rr '@base64d' | xxd -p -c64
and echo "V0MsL2hwbyCcGs2AMrFAKaSjPl8OuX4OWAEip+idGVU=" | base64 -d | xxd -p -c64
should be equal.
Environment (please complete the following information):
- OS and Version: Alpine Linux
- jq version: jq-master-v3.8.0-3651-g18d55b6bda
Additional context
Seems to be related to binary values being encoded.