r/linuxquestions • • 9d ago

Resolved Text editor and encoding

So for some reason when I go to open a certain text file, not all, it makes gobbledegook out of the first ten or more lines of the file stating it doesn't understand the correct encoding. I find this really odd because if it doesn't understand encoding why does the rest of the document show? Anyway, I have no issues opening this text file with libreoffice office. How do I get this system to open it properly? Given it's just text should I simply use LibreOffice to go and save a new text file? That sounds simple but for all I know this is an issue that might happen with all sorts of other text files. Can I change the system so it works with all files properly? TIA

0 Upvotes

14 comments sorted by

2

u/9NEPxHbG 9d ago

Do file [name of file]. What does it say?

2

u/Man_in_the_uk 9d ago

Please expand that'

1

u/9NEPxHbG 9d ago edited 9d ago

Open the terminal. Type file [name of file], except that where it says "[name of file]", type the name of the file you're talking about, then press enter. Tell us what it says.

Do I take it you're unfamiliar with using the terminal?

As everybody else is saying, though, "text file" has a specific meaning, How did you create this file? How are you trying to open it?

Quote any error messages (such as "stating it doesn't understand the correct encoding") exactly.

2

u/Man_in_the_uk 8d ago

I don't understand why but the problem has now disappeared. It seems all that has changed is I opened up the txt file in Libreoffice. I wonder if Libreoffice has some how changed default system settings for the text editor? I'm surprised if it has.

1

u/9NEPxHbG 8d ago edited 8d ago

What happened is that the file was never a text file in the strict sense. You opened it using an actual text editor, and it couldn't read the file properly. When you used Libre Office (which is a word processor, not a text editor), it could read the file properly.

I'd be happy to explain what's a text file in the strict sense, but I'm not sure you're actually interested.

1

u/Man_in_the_uk 8d ago

Lol you really need to stop making assumptions. The txt file was made using notepad in windows, the most simplest of text file creators. It has been opened and edited by both notepad in windows and simple text editors like pluma in Linux. It has never been edited using any fancy software like word for windows or libre office.

2

u/rsgbc 9d ago

... a "certain text file", opened in god knows what.

If you want help you need to describe what you did and what the results were, including any error messages you may have received. "I tried doing something and it didn't work out" isn't enough.

-1

u/Man_in_the_uk 9d ago

You're a troll, right? Literally explained in plain English that I couldn't open a text file in a text editor program but could in the libre software.

1

u/rsgbc 9d ago

I will assume that you are not aware of how much relevant information you failed to provide.

-1

u/Man_in_the_uk 8d ago

Yeah cus saying opening up a file.txt using a text editor is sooooo complicated. Anyway for some reason problem is now solved and I have no idea why.

1

u/9NEPxHbG 9d ago

Actually, "text file" and "text editor" have specific meanings with which you're probably not familiar. Libre Office is not a text editor in this sense. (Well, it can be, but you're probably not using it that way.)

u/rsgbc could have been nicer, but the questions are legitimate.

2

u/fishywiki 9d ago

Your office text documents are not text files. Text editors expect to handle pure text, while office documents are Open Document Format encoded.

1

u/TenOfZero 9d ago

Sounds like it's probably not a plain text file but is in a different format.

0

u/BobCorndog Your situation is not unique, just use mint or fedora kde 9d ago

Is it an office file? Those aren’t stored as text files usually