LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-20-2011, 08:07 AM   #1
Dr_Lion
LQ Newbie
 
Registered: Oct 2011
Posts: 4

Rep: Reputation: Disabled
Gedit wierd charaters


I'm not sure if this is the right place to post, if not be free to change and let me know.

I'm trying to open a .csv file in gedit (ubuntu lucid) and i get weird charaters as the title says, in open office it opens how it should, and if a try the cat in console i get the right output too.

i've searched a bit and i red something with fonts, in openofice it says Arial, i installed de package msttfonts but the problem didn't disapear.

Anyone knows how to fix this?

Thanks in advance.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-20-2011, 08:53 AM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Hello,

Could you post part of the file you are trying to open to better assist us? And also if you can, a screenshot if the characters don't appear within the post, thanks!

Cheers,

Josh
 
Old 10-20-2011, 09:17 AM   #3
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Gedit doesn't care about fonts, being a text editor. But it does care about character encoding, and that may be the problem. Is it perhaps a file from a windows system?
 
Old 10-20-2011, 01:40 PM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Well, fonts can be a problem if the one you're using doesn't have a needed character in it, but that's rather rare unless the text is in some uncommon language. An encoding problem is certainly more likely, particularly if there are just a few bad oddball characters scattered around the text.

gedit seems to offer no way to change the text encoding after a file is loaded, but the open dialog has a field at the bottom for selecting the encoding as you load it. You can also use the --encoding option on the command line.

Most editors try to autodetect encodings when loading the file, but they aren't perfect at it. Windows has traditionally used cp-1252, a Microsoft "variant" of ISO-8859, for English text. Other variants are available for various European languages. Keep trying them until you find one that works. Linux uses UTF-8, by the way.

You can use iconv to batch-convert files from one encoding to another, once you know what they are. You can try running the chardet command on it to see what comes up, but it's not always that accurate either (it likely uses the same library calls as the editors). If the output is less than 100% certain, don't trust it.

Finally, on a related note, don't forget that there's a difference between dos and unix style line-endings. Some programs auto-convert these as well, but not all. There are many options for manually converting line-endings in files, so I'll leave that as a research exercise for the OP.

Last edited by David the H.; 10-20-2011 at 01:42 PM.
 
2 members found this post helpful.
Old 10-21-2011, 12:00 PM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,131

Rep: Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302Reputation: 2302
If you don't know the encoding, can you tell us a character you're getting and what you think it should be? For example, I had a .txt file once that caused trouble. Once I saw Õ where there should be an apostrophe, I could look it up and see it Apple's 'Standard Roman'.
 
Old 10-27-2011, 05:30 AM   #6
Dr_Lion
LQ Newbie
 
Registered: Oct 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Well, i didn't solve my problem, but anyway with the cat command line it works, show it right, and for what i need i don't really need the gedit.

Now it's even better i would post it here but the gedit can't open it now, it says to choose the charset encoding, and ask for retry.

Thanks for the advices anyway.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Gnome 3, Gedit 3.0.5, when I open file with gedit, it created one more unneeded tab Mr. Alex Linux - Software 1 06-18-2011 07:58 AM
bash script, special charaters stopping cp zebrapositions Programming 11 09-20-2009 03:04 AM
Koffice charaters - howto pe2338 Linux - Software 1 08-26-2003 01:48 PM
more charaters in apache im1crazyassmofo Linux - General 0 03-09-2003 08:16 PM
Star Office Special charaters Fried General 0 09-15-2001 02:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:04 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