Hi, Tony,

Thanks for you reply.

I've already tried the xxd solution, but it converts all of the
characters into hex values, it is hard to locate a particular
character's value. It might be possible to copy this character out to
a new window and use ":%!xxd" to check its hex value, but it takes two
steps with an additional window. It is acceptable but a little bit
inconvenient.
(Is there any shortcut (i mean key-combination or function) for these steps?)

For the 2nd solution you proposed, it is not suitable for me since I
always need to handle many files with different encodings. That's the
reason why I set the encoding as utf-8.

Anyway, thanks for your idea. :)

Zhaojun

On 3/7/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
":set encoding=utf-8" tells Vim to use UTF-8 internally to represent all file
data. This is usually OK; but the replies to ga and g8 will be based on what
is in memory, i.e., the UTF-8 equivalents of the character at the cursor.

If you want to examine the actual cp936 data at a given point in the file, I
can think of two methods:

Method I. Convert to hex display.

This can be done by means of the "xxd" utility, which is normally distributed
together with Vim, as follows:

        xxd < filename.txt > filename.hex

"filename.hex", which is a text file, will then contain the hex values of all
bytes in the file, with at left the offset within the file in hex, and at
right the "text" as 16 ASCII characters per line, with unprintable bytes
replaced by dots.


Method II. Use cp936 as internal encoding. (Untested)

This means setting 'encoding' to cp936 rather than utf-8. Beware! You should
have no file in any other multibyte encoding in the same instance of Vim, not
even in a different window, not even hidden-but-modified. Better start afresh
with a new run of gvim, edit only that single file, use ga as necessary, and
close Vim when done.


Best regards,
Tony.
--
It's a damn poor mind that can only think of one way to spell a word.
                -- Andrew Jackson

Reply via email to