OrenIshShalom
OrenIshShalom

Reputation: 7102

gedit weird encoding of standard text file

This question is also posted in AskUbuntu here.

I have a standard text file that is shown perfect with cat:

$ cat myfile.txt
v0[shape = Mrecord, label = ""]

When I use xxd to examine the exact line ending I get this:

$ xxd myfile.txt
00000000: 7630 5b73 6861 7065 203d 204d 7265 636f  v0[shape = Mreco
00000010: 7264 2c20 6c61 6265 6c20 3d20 2222 5d0a  rd, label = ""].

However when I try to open it with gedit, I get a weird encoding of some non Latin language. What goes wrong in gedit?

EDIT:

Here is the complete source code for reproducing:

$ cat main.cpp
#include <fstream>
int main(int argc, char **argv)
{
    std::ofstream myfile("myfile.txt");
    myfile << "v0[shape = Mrecord, label = \"\"]\n";
    myfile.close();
    return 0;
}

And here is my compilation line:

g++ main.cpp -o main

In addition, I'm attaching the image file of the the gedit screen:

gedit prnt scrn with non latin letters

Upvotes: 0

Views: 388

Answers (0)

Related Questions