LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Symbol changes when copy and pasting to a new file (https://www.linuxquestions.org/questions/linux-newbie-8/symbol-changes-when-copy-and-pasting-to-a-new-file-4175412305/)

mrm5102 06-19-2012 12:45 PM

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

pan64 06-19-2012 12:55 PM

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.

mrm5102 06-19-2012 01:45 PM

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

mrm5102 06-19-2012 02:01 PM

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

pan64 06-19-2012 02:11 PM

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.


All times are GMT -5. The time now is 11:20 AM.