Vim, iconv+nr2char and iconv+"\x.."
echo strtrans(iconv( "\x80", "utf-8", "utf-32"))
Outputs «??» and
echo strtrans(iconv(nr2char(0x80), "utf-8", "utf-32"))
outputs «<80>». Why?
(zyx:~) % LANG=C vim --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 12 2010 07:37:05)
Included patches: 1-303 开发者_Python百科
Modified by Gentoo-7.2.303
Because nr2char(0x80)
results in U+0080
, which is equal to "\xc2\x80"
. And "\x80"
is not a valid utf-8 string.
精彩评论