LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-06-2005, 06:09 AM   #1
zarkon
LQ Newbie
 
Registered: Feb 2004
Location: Glenrothes, Scotland
Distribution: Fedora Core 1
Posts: 2

Rep: Reputation: 0
Nautilus and Gedit fail to open text files


I have a whole load of text files that I saved when I used MS Windows but I can't open then in Nautilus or Gedit - both complain about invalid utf-8 data.

I can open them in Konqueror and Kedit and can see the invalid data - it's one character at the end of the file which Konqueror / Kedit represents as a square. If I delete that character then Nautilus and Gedit can open the files up.

Is this a bug in Nautilus / Gedit or am I missing some fonts? Why does Konqueror / Kedit cope when the others can't?

I'm using RHEL v3 on a IBM T41 laptop.

Cheers
 
Old 04-06-2005, 08:16 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I don't know why some editors are able to open them and others are not.
You are right about the character in those files and quite often I hear about it when someone tries to run a script which was created in windows notepad. They get this kind of error....
# ./test
: bad interpreter: No such file or directory

Here is a script which may help you get rid of the problem. For example, the text files are in /home/images...
Code:
#!/bin/bash
cd /home/images
for i in `ls *.txt` ; do
cat $i | tr -d '\015' > $i
done
 
Old 04-06-2005, 08:29 AM   #3
zarkon
LQ Newbie
 
Registered: Feb 2004
Location: Glenrothes, Scotland
Distribution: Fedora Core 1
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by homey
Here is a script which may help you get rid of the problem. For example, the text files are in /home/images...
Thanks for that.

it kind of works - the test file I used can now be opened but half of the real text is missing!!

Alan
 
Old 04-06-2005, 10:00 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I'm glad you are smart and use a test file to see if it works.

Maybe it's because I tried to overwrite an open file in this line...
cat $i | tr -d '\015' > $i

Edit: this one is a better idea if you have spaces in the file name...
Code:
#!/bin/bash

mkdir /home/tmp 2> /dev/null
cd /home/images

for i in *.txt ; do
cat "$i" | tr -d '\015' > "/home/tmp/$i"
done
mv -v /home/tmp/*.txt /home/images

Last edited by homey; 04-06-2005 at 11:31 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Gedit problems openning files UmneyDurak Linux - Software 6 11-24-2005 07:45 PM
gedit wont save files!! pman Fedora 3 02-22-2005 02:09 AM
text files that dont open with notepad the_imax General 6 02-16-2005 05:52 AM
Text selection problem with Gedit liaohaohui Linux - Software 0 11-18-2004 04:18 AM
open hidden files gedit 2.6 buldir Linux - Software 5 06-20-2004 02:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:00 AM.

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