All Gurus once were Newbies
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
- Level 3
- Posts: 171
- Joined: Tue Jul 29, 2014 11:21 pm
I'm having some trouble with output redirection. I'm running a pdf search program called pdfgrep (it's amazing, highly recommended) and am trying to save my results to a file. I've aliased a long pdfgrep command to fpdf in my .bashrc so I don't mistype it. When I try and do:
(The command fpdf foo returns a long list of search hits for foo in a directory of pdfs).
The code above exits normally, no errors. Output.txt is visible in nemo and using the ls command. However, when I try opening it with gedit, the file will not open -- gedit errors about not detecting the character encoding. However, opening in libre word works just fine.
What's up with gedit? The file is obviously there and written correctly, so why can't it read it?
- Level 5
- Posts: 652
- Joined: Wed Jun 15, 2011 5:19 pm
- Location: The Hague, NL
Most likely the actual command behind the fpdf sends one or more 'invalid' characters to the output. Invalid is whatever gedit thinks is invalid. It may be an improperly encoded top-bit-set character, i.e. an ISO-8859-1 character that ends up in an otherwise UTF-8 environment. I remember gedit used to be very picky about that (one of the reasons I ditched that piece of junk in favour of geany).
As I haven't used it in a long time, I'm not sure if you can tell the current incarnation of gedit to switch off its encoding detection and use whatever you tell it to. If you can, (temporarily) switching to one of the ISO-8859 encodings might work.
- Level 23
- Posts: 17817
- Joined: Sat Dec 06, 2014 7:34 am
- Level 3
- Posts: 138
- Joined: Sat Jun 04, 2016 3:13 pm
- Location: Earth/North America/USA/home
You can also try atom to replace gedit. I used to run into gedit surprises (weird chars even though it is set to UTF-8) too as far a encoding is concerned.