UTF8, base64 and other encoding conversion
Sat 30 April 2016
[caption id="" align="alignright" width="100" class="zemanta-img"] encoding conversion (Photo credit: Wikipedia)[/caption]
A common way to represent binary files in ascii-only diplay is to use base64. This is also done a piece of software does not handle unicode: it manipulate its base64 representation.
Let's take as example this 2 binary sequence represented in base64:
6YCZ5YCL57ay56uZ5piv576O6bqX55qECg== and dGhpcyB3ZWJzaXRlIGlzIGJlYXV0aWZ1bAo=
- to text/unicode: echo '6YCZ5YCL57ay56uZ5piv576O6bqX55qECg==' | base64 -d echo 'dGhpcyB3ZWJzaXRlIGlzIGJlYXV0aWZ1bAo=' | base64 -d
- to text/unicode: echo '6YCZ5YCL57ay56uZ5piv576O6bqX55qECg==' | base64 -d | xxd -p -i | sed -e's/, //g' echo 'dGhpcyB3ZWJzaXRlIGlzIGJlYXV0aWZ1bAo=' | base64 -d | xxd -p -i | sed -e's/, //g'
- from hex: echo 'e98099e5808be7b6b2e7ab99e698afe7be8ee9ba97e79a840a' | xxd -p -r
- mix hex and ascii to ascii: echo -e 'this\x20website\x20is\x20bueatiful'
Category: tools Tagged: ASCII Base64 Binary file Linux Unix-like tools unix-like