2

I am running a node.js server and the following line just isn't working.

console.log("☺☻♥ مرحبا 你好");

I opened up the file in nano and cat on my ubuntu server 14.04 (no gui, no window manager, no kde, no gtk, no nothing, pure ubuntu server 14.04) and it looks like this:

nano

I have the file in a samba share and when I open it in Windows 8 pro it looks as so in notepad++:

notepad++

notepad++ encoding

This is how the samba config looks like this, the private shares do not have anything fancy or to do with charsets:

samba

Locale looks as so:

enter image description here

/etc/default/locale looks like:

enter image description here

And the following command displays a Ô in the ubuntu server terminal:

perl -CO -le ‘print “\x{d4}”’

Like so:

enter image description here

I use the command start_unicode and then hold in ALT while typing 1236 and got a diamond!

I ran the following:

sudo touch /srv/file.txt
sudo bash -c 'echo -e "\xe2\x82\xac"' > /srv/file.txt

This resulted in a very nice € symbol in nano however when trying to display the following ☺☻♥ it does not work (black diamonds)

Anyone got any ideas?

  • its because editors like nano don't support it - hvae you tried using cat instead of nano? – Wilf Jul 04 '14 at 17:54
  • cat displayed the exact same I'm afraid! – Karl Morrison Jul 04 '14 at 18:00
  • @Wilf, editors like nano support it just fine. Is this over a local session, or ssh? Typically this sort of thing happens when using a poor ssh client ( typically from windows ) that doesn't speak utf-8, or when using a bad font that doesn't support those characters. – psusi Jul 04 '14 at 18:19
  • @psusi the file works in Windows in notepad, notepad++, komodo edit. I am using standard Samba so it's not ssh as far as I know! – Karl Morrison Jul 04 '14 at 18:23
  • I mean when you open it in nano... is this in a gnome terminal on the server? – psusi Jul 04 '14 at 18:25
  • @psusi Ubuntu Server 14.04 via the terminal! – Karl Morrison Jul 04 '14 at 18:26
  • Can you try another terminal like Terminator? – muru Jul 04 '14 at 18:38
  • @muru I have not installed a window manager as it is a server. I suspect that nor nano or cat is the issue as node.js also does not display the correct characters when running! – Karl Morrison Jul 04 '14 at 18:44
  • You were using the virtual terminals all the while? Then you might want to look at http://askubuntu.com/questions/23610/how-to-enable-unicode-support-in-a-tty. – muru Jul 04 '14 at 18:57
  • @muru I must stress I have installed nothing but ubuntu server 14.04, samba and nodejs (in that order). Nothing else, no windows manager, no kde, no gtk, nada (I have updated the system though). – Karl Morrison Jul 04 '14 at 19:40
  • That's fine. I assume you are accessing the server physically? – muru Jul 04 '14 at 19:41
  • Indeed! It is on a VM on my Windows 8 Pro laptop (virtual box). the VM however shouldnt have an impact on this! I also tried that link, no to avail. – Karl Morrison Jul 04 '14 at 19:55
  • I use the command "start_unicode" and then hold in "ALT" while typing "1236" and got a diamond! – Karl Morrison Jul 04 '14 at 20:07

1 Answers1

0

Your LANGUAGE value is invalid. I really don't know, but possibly it confuses your system. Since you apparently don't want to use a language priority list anyway, you may want to drop the setting of LANGUAGE.

Gunnar Hjalmarsson
  • 33,540
  • 3
  • 64
  • 94