echo "\u6c49\u5b57" | \
sed 's/\\u\(..\)\(..\)/\\x\2\\x\1/g' | \
sed 's/.*/\"\\xff\\xfe&\"/g' | \
xargs printf | iconv -f utf-16 -t utf-8
ref: this & this
convert unicode chartset to utf8 in CLI
poster:
MarlboroMoo on
2009-08-07
15:00
tag:
bash,
command-line,
plurk
因為從 plurk 的 getPlurks 接回來的資料被轉成 unicode 了,所以使用以下方法轉回 utf8.
Related Posts:
- plurk.sh - 2009-07-04
- Linux cheatsheet - 2009-06-04
- postwp-mu.sh - 2009-05-30
- mutt plus msmtp in ubuntu 9.04 - 2009-06-20
- plurk in ubuntu 9.04 part 2 - 2009-07-04
0 comments:
張貼留言