Gnome VFS and GtkTextBuffer, character encodings?



I'm still wet behind the ears hear so bare with me. I'm trying to load a text file into a GtkTextBuffer. When doing so with local text files, no problem. However, when I open a file that I created on my Windows system, the program crashes due to utf8 validation. So used g_utf8_validate() to catch this. However, I need to be able to read this type of file (it's a text file containing assembly code). I'm using something like the following to read the file (using gnome-vfs):
do {

result = gnome_vfs_read (handle,
           text_buffer,

BUFFER_SIZE,
           &bytes_read);

   bytes_total += bytes_read;

} while(result == GNOME_VFS_OK);

if(result == GNOME_VFS_ERROR_EOF) {

   text_buffer = g_strconcat("", NULL);

}


Is there some easy way to determine the character coding of the file I'm opening and make a conversion before trying to put it into a GtkTextBuffer?

- Micah



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]