0

When I copy a webpage from my local machine (Mac) to my remote server (Ubuntu), the special characters in the text are ending up in squares in a browser or question-mark-symbols in the terminal.

I tried copying them with scp or ftp; same problem.

I checked the language on the server: LANG=en_US.UTF-8. This seems right and shouldn't be the problem anyway because when I edit the file in the terminal on the server, special characters display as they should.

Already searched for hours but can't find the solution. Anyone an idea?

2
  • Are you using high ASCII characters instead of HTML entities?
    – user8290
    Jan 3, 2013 at 14:23
  • Yes, I just have some raw text in a html file with é in it. Not é This should be possible right?
    – Teasze
    Jan 3, 2013 at 14:35

1 Answer 1

1

Using UTF-8 can solve a lot of that problem, but you still have to use HTML entities for reserved XML characters (ampersand, less-than, greater-than). So, either use HTML entities or serve the webpage with an HTTP header that says it's UTF-8. That could be done with an HTML header or META tag:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

Or, in the Ubuntu web server change the default encoding:

Apache: AddDefaultCharset utf-8

nginx: charset utf-8;

On the terminal, you know that the server is using UTF-8 (locale), so make sure that your SSH client is set up correctly. For example, if using Putty, we have to set Putty's character set:

Putty: Window->Translation->Remote character set: UTF-8

Otherwise, it will use ISO-8859-1.

Putty Translation

And check what format the editor is using.

file file.ext

We should see "UTF-8 Unicode text" if the editor is writing UTF-8 files.

7
  • Thanks for your help but I don't think that's the solution. I already had this meta tag in the file and I doubt if it is a apache thing because the I can't see the special characters even if I open the file n terminal.
    – Teasze
    Jan 3, 2013 at 15:20
  • Sorry - I neglected the terminal portion... updated answer. :)
    – user8290
    Jan 3, 2013 at 15:27
  • blog.remibergsma.com/2012/07/10/…
    – user8290
    Jan 3, 2013 at 16:02
  • I've tried but with no luck. Not with scp via terminal, not with an ftp program.
    – Teasze
    Jan 3, 2013 at 16:39
  • However, you did put me on the right track! When I checked the settings of my editor, I saw the text encoding was by default on Western. This fixed it. Thanks for your help!
    – Teasze
    Jan 3, 2013 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .