views:

23

answers:

2

I'm trying to port a curses program to Windows. Now one of the problems is that the default ACS_XXXX characters become double-width on Windows console, thus breaking the alignment.

I tried looking for other characters to do the job, like '-' or '|' in basic ASCII, but none of them looks good because the line is not continuous. And finding characters to "draw" corners seems more difficult.

Are there any commonly used characters in such a situation?

A: 

There are border characters in the system font. This includes joints, corners, and both double and single edges. They appear in the higher positions.

Check out http://www.asciitable.com/ for details. They range from 179 to 218 (decimal) in the extended ascii table.

JoshD
I can't use the extended part of ASCII, because my system defaults to CodePage 936, and it believe they're part of a Chinese character...
hpsMouse
A: 

There are a few box drawing characters that were available in the old DOS days - you should be able to use those.

However, keep in mind that the Windows console may require some jumping through hoops to output this as Unicode, which might be a problem unless you accept that your code editor is unlikely to display the character correctly. Michael Kaplan summarizes the problem quite nicely, with information about how to get around this.

Michael Madsen
That's what curses defaults to output. They work perfect on a traditional linux console. The source of the problem is that I use a Chinese version of Windows, and the console uses Chinese font, in which those Unicode box characters become double-width.
hpsMouse
@hpsMouse: Ah, that's what you meant... in that case, I don't have any suggestion other than selecting a different font for that executable - but that's hardly ideal either, especially not for other people.
Michael Madsen