vi editor garbled file

I am trying to edit a file and when I vi the file, I get rolling lines and garbled messages. So much that I did not want to edit the file for fear of screwing up the file.

I am logged in a Sun Box through a Windows Hyperterminal to a SunFire box serial port.

I presume that my display is not set up correctly. echo $TERM shows sun but when I vi editor a file it rolls and produce some garbage. I presume I have to set my display. Any ideas how to determine what display to set it to? Should I set a display according to the box model like v100, something like that?

what is the output of:

# file yourfile

?

ascii text

Duke...I know this is a easy problem but I always get confused with setting up display/term from a remote box when serial connecting to a SUN server.

TERM being "sun" is certainly wrong as you are remotely connected.

Try using "export TERM; TERM=vt100" or "TERM=xterm" which more likely match your terminal emulator.

you can do the following

vi filename
press ESC

write " :set number"

press enter

now start editing the file

this thing worked in my case. You should give it a shot