LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-19-2012, 01:45 PM   #1
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Rep: Reputation: 3
Symbol changes when copy and pasting to a new file


Hello All,

This question below is about the content of an MRTG config file but the fact it's MRTG isn't really relevant, it's basically a plain text file...

Well anyway, I have a file where a couple of lines in the file contain the degree symbol, i.e. -->
The original file is displayed on a web frontend of Routers2 (probably not relevant either), and it displays
perfectly as it is with the Degree symbol showing correctly on the page. Which shows like this:
Code:
Degrees F
So I wanted to make some changes to the file and keep the original. So I simply copy/pasted the file from a server's Gedit program (running remotely with SSH) into a new file and made some changes (using the same Gedit window, but just into a new Gedit Tab). Now when I view this NEW page in the browser it is shown as this:
Code:
Degrees °F
So I'm assuming that something is happening when I'm copy/pasting to the new file. When viewing this line (for both files) say
in VI or Gedit it shows just fine. So I ran the "od -a" command on both files and it is showing that there is an extra character
within the NEW file's Octal representation.

Here's the output from the the "od -a" commands:
Code:
### GOOD FILE:
D   e   g   r   e   e   s  sp   0   F  nl

### BAD FILE
D   e   g   r   e   e   s  sp   B   0   F  nl

As you can see above there is an extra character showing up after the copy/pasting. Not exactly sure what's going on... Puzzled..???

If anyone has any idea what's happening or has a better way in which copying the new file would create an EXACT replica of the original would be great!!


Thanks in Advance,
Matt
 
Old 06-19-2012, 01:55 PM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,514

Rep: Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436
Can you please describe in detail how the new filename was generated. by copy/pasting with mouse, or by some other way? Probably the app you used cannot handle this properly, or not configured properly. Using another application also may help (depends on your window manager, you can try gnome commander or simple command line tools also).






__________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
 
1 members found this post helpful.
Old 06-19-2012, 02:45 PM   #3
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
Hey pan64, thanks for the reply!

I'm pretty sure I just simply had the file open in Gedit (which was opened from a terminal during an SSH session to a server,
so I was using the server's Gedit application and not my local Gedit). Then I did a "ctrl-a" to select all, then "ctrl-c" to
copy, opened a new tab and did a "ctrl-v" to paste.

I guess I'll try doing a "cp" on the original file then edit the new "copied" file and see if that has the same outcome.

Thanks again for your reply,
Matt
 
Old 06-19-2012, 03:01 PM   #4
mrm5102
Member
 
Registered: Apr 2011
Location: Philadelphia
Posts: 158

Original Poster
Rep: Reputation: 3
Ok... Looks like doing a "cp" on the original instead of doing a copy/paste manually fixed my problem.
No more weird characters!

I guess possibly since I was using Gedit through the terminal from another server, when I copied/pasted it, it ran the copied
"material" through my laptops machine which I guess could have a different encoding or locale (or something like that) then the server has,
and possibly "re-encoded" the characters... Just a shot in the dark lol.


Thanks again for your suggestions!


Thanks,
Matt
 
Old 06-19-2012, 03:11 PM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,514

Rep: Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436
probably you are right: the encoding, the handling of "strange" signs is not an easy case especially across different hosts and locales. Glad to help you.
 
  


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
[SOLVED] Preserve colors when copy/pasting from terminal it_tyyppi Linux - Desktop 14 05-04-2012 08:21 AM
Copy and pasting between terminals enortham Linux - Software 4 12-27-2005 10:45 AM
copy pasting from X app to vim Furlinastis Linux - General 3 12-05-2005 10:05 PM
copy pasting in emacs wogga Linux - Software 7 06-16-2004 04:12 PM
Questions on copy+pasting, gdesklets and more! Tyir Linux - General 2 03-23-2004 03:52 AM


All times are GMT -5. The time now is 05:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration