EncodeZeroWidthSpace.sh

kanata, 05/01/2018 04:24 PM

Download (333 Bytes)

 
1
#!/bin/bash
2

    
3
ZWS1=$'\u200b'
4
ZWS2=$'\u200c'
5
ZWS3=$'\u200d'
6
ZWS4=$'\ufeff'
7

    
8
if [ -p /dev/stdin ] ; then
9
  CONTENT=$(cat -)
10
else
11
  CONTENT=$1
12
fi
13

    
14
printf "'"
15
echo $CONTENT|xxd -p|tr a-z A-Z|sed 's/^/obase=4; ibase=16; &/g'|bc \
16
  |sed s/0/$ZWS1/g \
17
  |sed s/1/$ZWS2/g \
18
  |sed s/2/$ZWS3/g \
19
  |sed s/3/$ZWS4/g \
20
  | tr -d '\n'
21
echo "'"
22

    
Add picture from clipboard (Maximum size: 100 MB)