LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2005, 09:02 PM   #1
MicahCarrick
Member
 
Registered: Jul 2004
Distribution: Fedora
Posts: 241

Rep: Reputation: 31
Loading a text file into a GtkTextView fails g_utf8_validate()


I have a little program I'm writing and it's using a GtkSourceView. When I load text files I've created on my own system, it works fine. However, when I try to load a file that was created using a windows system, I cannot load it because it fails the utf8 validation. How can I detect the type and convert it to utf8 so that it can be used in the GtkTextBuffer?

PS. I'm using C and GTK+ to write the application for Gnome.
 
Old 09-13-2005, 05:54 AM   #2
dub.wav
Member
 
Registered: Aug 2003
Location: Norway
Distribution: FC4
Posts: 83

Rep: Reputation: 20
gedit has some kind of character set auto detection, I suppose you could take a look at the source.
 
Old 09-20-2005, 09:58 PM   #3
MicahCarrick
Member
 
Registered: Jul 2004
Distribution: Fedora
Posts: 241

Original Poster
Rep: Reputation: 31
I've gotten a solution... Instead of using the Gnove VFS functions to load the file, I'm doing it with GIOChannel and forcing the UTF-8 encoding.

Thanks for the help.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Which light text editor can copy text from file and paste in browser? davidas Linux - Software 9 03-06-2006 11:28 AM
How to find and change a specific text in a text file by using shell script Bassam Programming 1 07-18-2005 07:15 PM
Loading debian26 fails carlosinfl Debian 19 06-08-2005 09:26 AM
Multiline GtkTextView in gtk+ 2.0 zer0python Programming 0 04-06-2004 09:33 PM
loading from text file using column width spyghost Programming 5 11-03-2003 01:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration