canyon
Posts: 38
Joined: Sun Jan 29, 2012 9:47 am
Location: London UK

PuTTY/utf-8 confusion

Tue Oct 30, 2012 3:31 pm

I'm getting odd results using curses-based programs when I access my Raspberry Pi from my Windows PC using PuTTY/ssh. I'm using the latest Raspbian image and PuTTY (0.62).
I have PuTTY set up to display utf-8 (Window > Translation > Remote chatacter set > UTF-8) and my Raspberry Pi is set to the ' en_GB.UTF-8' locale.

From PuTTY, if I run Midnight Commander:

Code: Select all

 ~ $ mc
I get the display I expect, with the borders around the panels showing as lines.
As a "control" I change the PuTTY setting to 'ISO-8859-1:1998 (Latin-1, West Europe)' and the borders in Midnight Commander now display as an ascii character (a with a circumflex).
This is as expected.

I now repeat the experiment with moc (music on console):

Code: Select all

 ~ $ mocp
With PuTTY set to utf-8, the borders display as ascii characters (x for the verticals, l for the corners, q for the horizontals). If I set PuTTY to ISO, moc displays correctly.
I also noticed that in my music listing, é displays correctly with PuTTY in utf-8, but displays as é in ISO.

As a further test I ran this python script:

Code: Select all

import curses

myscreen = curses.initscr()

myscreen.border(0)
myscreen.addstr(12, 25, "Python curses in action!")
myscreen.refresh()
myscreen.getch()

curses.endwin()
This behaved in the same strange way as moc - OK in ISO, asci characters in utf-8.

If I run the same programs from the Raspberry Pi's local console they all behave correctly, that is displaying lines and corners for the borders.

Can someone explain this behaviour? Is it a bug in one or more of the items I'm using (ssh, PuTTY, moc, mc, python??) or have I configured a setting wrong somewhere?

canyon
Posts: 38
Joined: Sun Jan 29, 2012 9:47 am
Location: London UK

Re: PuTTY/utf-8 confusion

Tue Oct 30, 2012 3:35 pm

just a bit more info:
If I acccess my Raspberry Pi from the same PuTTY session, but running screen:

Code: Select all

~ $ screen bash
Everything dispays correctly, as on the local console.

User avatar
jojopi
Posts: 2978
Joined: Tue Oct 11, 2011 8:38 pm

Re: PuTTY/utf-8 confusion

Tue Oct 30, 2012 5:50 pm

This seems to be a known issue: http://www.chiark.greenend.org.uk/~sgta ... vt100.html

Other terminal emulators, such as xterm which PuTTY claims to be, do support mixed UTF-8 and VT100 Alternate Character Set. This only makes it less likely that the applications will be updated.

Running everything in screen looks like a reasonable workaround. It translates the legacy line drawing characters to their Unicode equivalents.

canyon
Posts: 38
Joined: Sun Jan 29, 2012 9:47 am
Location: London UK

Re: PuTTY/utf-8 confusion

Wed Oct 31, 2012 2:24 pm

@jojopi:
Thanks for the clarification, I understand the issue a bit better now.

I've added "screen bash" in "Connection > SSH > Remote command" in the PuTTY Configuration for my session. That solves the issue for my three examples.

dioltas
Posts: 2
Joined: Wed Feb 12, 2014 9:48 am

Re: PuTTY/utf-8 confusion

Wed Feb 12, 2014 10:05 am

Hi, I had this same issue.

Found a solution from these pages:

http://mathy.vanvoorden.be/blog/2013/03 ... -num-lock/
http://www.koerner.in/2011/08/ugly-bord ... ing-putty/

Once you've UTF-8 set up properly, looks like you just have to change the terminal type string in Putty, in Connection -> Data.

http://the.earth.li/~sgtatham/putty/0.5 ... onfig-data

Setting it to "putty", instead of "xterm" seems to fix the issue. Unfortunately I'm not 100% sure why this works, but I'm guessing that any string other than xterm might work. I suppose the server expects xterm to be able to support the mixed symbols, whereas putty doesn't support them properly.

Setting it to putty must change what the server sends, but it works anyway, even without screen.

dioltas
Posts: 2
Joined: Wed Feb 12, 2014 9:48 am

Re: PuTTY/utf-8 confusion

Wed Feb 12, 2014 10:06 am

Hi, I had this same issue.

Found a solution from these pages:

http://mathy.vanvoorden.be/blog/2013/03 ... -num-lock/
http://www.koerner.in/2011/08/ugly-bord ... ing-putty/

Once you've UTF-8 set up properly, looks like you just have to change the terminal type string in Putty, in Connection -> Data.

http://the.earth.li/~sgtatham/putty/0.5 ... onfig-data

Setting it to "putty", instead of "xterm" seems to fix the issue. Unfortunately I'm not 100% sure why this works, but I'm guessing that any string other than xterm might work. I suppose the server expects xterm to be able to support the mixed symbols, whereas putty doesn't support them properly.

Setting it to putty must change what the server sends, but it works anyway, even without screen.

Return to “Troubleshooting”

Who is online

Users browsing this forum: bulletmark, dirdled, Tzarls, XueHai8 and 49 guests