what's the meaning of ^@, ^I and $ in vi?
Solution 1
$
is the end of line as displayed by :set list
with the default value of the listchar
option. ^I
is the tab character.
^@
is the null
character.
For some weird reason every meaningful character in your file is prepended with a null
character except digits and (probably) spaces.
This is not a Vi(m) problem: check the documentation of that method to see if there's a way to output your data without those null
s.
Solution 2
The file that you opened is UTF-16 or UCS-2 encoded, which is the standard in Java. vi
(as in real vi
, not vim
symlinked to vi
) can only handle ASCII (or ISO-8859-1?) text. Use vim
, or convert the file to ASCII (e.g., iconv -f utf-16 -t ascii <input> <output>
).
Related videos on Youtube
Comments
-
Ritsu Caps over 1 year
When I try to use Context.write(k,v) in MapReduce(using Java) to write data to a file ,I find the following contents in file(opened with vi, have :set list):
^@R^@u^@n^@^I1$ ^@a^@c^@c^@e^@s^@s^@^I1$ ^@d^@e^@f^@a^@u^@l^@t^@ 2$ ^@o^@u^@t^@^I2$ ^@p^@r^@o^@j^@e^@c^@t^@^I1$ ^@t^@a^@s^@k^@^I1$ ^@w^@i^@n^@d^@o^@w^@s^@^I1$ ^@y^@o^@u^@r^@^I1$
What's the meaning of
^@
^I
and$
? Does^I
mean\t
? I know that$
means the end of the line, but does it mean the enter key, just like\n
? If so, what's the difference between '$' and '^M' in vi? -
pilona over 10 yearsShouldn't vim automatically detect the encoding? Or does it only do that when there's a BOM?
-
Ingo Karkat over 10 years@pilona: What gets detected is controlled by the
'fileencodings'
option that I've mentioned.