wrong character encoding

hey all
hope u guys can help me out as it is urgent... when trying to open a file on my flash memory this error keeps popping out

gedit has not been able to detect the character encoding.
Please check that you are not trying to open a binary file.
Select a character encoding from the menu and try again.
i am working on ubuntu .... and using NS2, dont know what seems the problem can anyone plz help me
Is the file a text file?
Thank u 4 ur reply.... yes its a plain text file ... here's a snap shot of a similar trace file

s 82.320846165 _8_ MAC  --- 0 ACK 38 [0 6 0 0] 
r 82.320861165 _8_ AGT  --- 91718 tcp 572 [26 8 6 800] ------- [6:3 8:0 32 8] [44627 0] 1 1
s 82.320861165 _8_ AGT  --- 91782 ack 40 [0 0 0 0] ------- [8:0 6:3 32 0] [44627 0] 0 1
r 82.320861165 _8_ RTR  --- 91782 ack 40 [0 0 0 0] ------- [8:0 6:3 32 0] [44627 0] 0 1
s 82.320861165 _8_ RTR  --- 91782 ack 60 [0 0 0 0] ------- [8:0 6:3 32 6] [44627 0] 0 1
r 82.320873824 _6_ MAC  --- 0 ACK 38 [0 6 0 0] 
s 82.321183801 _8_ MAC  --- 0 RTS 44 [ab 6 8 0] 
r 82.321215824 _6_ MAC  --- 0 RTS 44 [ab 6 8 0] 
s 82.321225824 _6_ MAC  --- 0 CTS 38 [85 8 0 0] 
r 82.321253483 _8_ MAC  --- 0 CTS 38 [85 8 0 0] 
s 82.321263483 _8_ MAC  --- 91779 ack 118 [26 6 8 800] ------- [8:0 6:3 32 6] [44625 0] 0 1
r 82.321349323 _6_ MAC  --- 91779 ack 60 [26 6 8 800] ------- [8:0 6:3 32 6] [44625 0] 1 1
s 82.321359323 _6_ MAC  --- 0 ACK 38 [0 8 0 0] 
r 82.321374323 _6_ AGT  --- 91779 ack 60 [26 6 8 800] ------- [8:0 6:3 32 6] [44625 0] 1 1
s 82.321374323 _6_ AGT  --- 91783 tcp 552 [0 0 0 0] ------- [6:3 8:0 32 0] [44657 0] 0 1
r 82.321374323 _6_ RTR  --- 91783 tcp 552 [0 0 0 0] ------- [6:3 8:0 32 0] [44657 0] 0 1
s 82.321374323 _6_ RTR  --- 91783 tcp 572 [0 0 0 0] ------- [6:3 8:0 32 8] [44657 0] 0 1
r 82.321386982 _8_ MAC  --- 0 ACK 38 [0 8 0 0] 

plz help me out as this is my backup files ... and I don't know why such an error is popping up
thanx in advance
You probably have non-printable character in the file, possibly some kind of file corruption.
There's really no such thig as a 'plain text file'. Unless your just writing the stings to file yourself and not writing a header first. You see if you are playing by the rules you should write a small header at the start of your text files to tell the program that's reading the 'text' how to interpret the text. If you write a text file and are using Unicode then your header would consist of:

0xff 0xfe

If your are using UTF-8 your header would be:

0xef 0xbb 0xbf

etc, ...

If you are using ASCII then you can leave the header out (as far as I know) and then the encoding used for your text is ASSUMED to be ASCII

HTH
@kbw it does open with another application called openoffice.org word processor but not the gedit... the main problem is that I need to perform certain calculations on this file .. if it is experiencing some kind of a file corruption .. this wouldn't give an accurate results..... or is it possible to still use this file .....and if not ..any ideas how can i restore it as this file is my back up file... thanx in advance
@ajh32.. well i am writing strings to the file myself.... but i still don't don't know which encoding character should i use ... thanx in advance
Well how are you writing the file, and what character set are you using? I'm guessing that you're using Unicode. In which case try adding the following to the beginning of your file:

0xff 0xfe

Let us know if that resolves your problem.
@ajh32 .... This file is automatically created as a result of certain simulation done through a tcl code i have created .... i don't think at this stage i can write anything to the file :( ... is there any other option i can use to restore this file ? would highly appreciate it if u can help ... thanx in advance
You could edit the file in a hex editor and append the two characters to the front of the file to try it out.

If you wrote the code that writes the file then you can add the text encoding header as well?
Topic archived. No new replies allowed.