Reputation: 84766
When I open a file using vi I see the following line:
00:00:15:Co<9c> Ty!
What is hidden under <9c>
and how can I make a global replacement for all occurrences of this strange sign? File is encoded with UTF-8
Upvotes: 0
Views: 440
Reputation: 1377
Your file contains the byte 0x9c, as previously mentioned in Ingo Karkat's answer. When a text file contains bytes in the range 0x80–0x9f, it oftentimes indicates that the file is in Windows-1252 encoding (or a different Windows code page for non–Western-European locales).
To view the file as a Windows-1252–encoded file in Vim, enter :e ++encoding=windows-1252
. The text in the question then appears as
00:00:15:Coœ Ty!
I can't tell you if that is the correct character, though. If instead the intended encoding is Windows-1250, for Central European languages, the command :e ++encoding=windows-1250
will make the text appear as
00:00:15:Coś Ty!
Upvotes: 1
Reputation: 172540
The <9c>
is the single character with the value 0x9c
= decimal 156; in UTF-8, this is U+009C String Terminator
. You can replace it via one of the following alternatives:
yl
) and insert it in a :substitute
command via :help c_CTRL-R
: :%s/<C-r>"//g
:substitute
command: :%s/<C-v>x9c//g
; cp. :help i_CTRL-V_digit
.\%x9c
regular expression atom in the :substitute
command: :%s/\%x9c//g
; cp. :help /\%x
.Upvotes: 1