recode tips

So why bother iconv, dos2unix, unix2dos when we have recode...
#显示所有有效的字符集及其别名
recode -l | less

#转换Windows下的ansi文件到当前的字符集(自动进行回车换行符的转换)
recode windows-1252.. file_to_change.txt

#转换Windows下的ansi文件到当前的字符集
recode utf-8/CRLF.. file_to_change.txt

#转换Latin9(西欧)字符集文件到utf8
recode iso-8859-15..utf8 file_to_change.txt

#Base64编码
recode ../b64 < file.txt > file.b64

#Quoted-printable格式解码
recode /qp.. < file.txt > file.qp

#将文本文件转换成HTML
recode ..HTML < file.txt > file.html

#在字符表中查找某符号(e.g.欧元)
recode -lf windows-1252 | grep euro

#显示字符在latin-9中的字符映射
echo -n 0x80 | recode latin-9/x1..dump

#显示latin-9编码
echo -n 0x20AC | recode ucs-2/x2..latin-9/x

#显示utf-8编码
echo -n 0x20AC | recode ucs-2/x2..utf-8/x

0 comments:

Post a Comment

| More

Twitter Updates