bredzhang / shellinabox

Automatically exported from code.google.com/p/shellinabox
0 stars 0 forks source link

Add 80/132 column mode #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I am struggling to display VT100 line drawing characters in shellinabox. I have 
tried different 
character encodings in different browsers running on different OS. The 
shellinabox daemon is 
running on CentOS 5.3.

What steps will reproduce the problem?
1. I have tried different character encoding selections in Firefox 3.5.5 and 
Safari 4.0.4 on Mac 
10.6 and Firefox 3.0.12 on Centos 5.3.
2. I have attached cp437.html that displays the expected line drawing 
characters when the 
character encoding is set to Default in Safari and Western (IBM-850) in 
Firefox. Note that the 
page has a META tag that defines charset=ibm437.
3. I have attached mcc.log which is a capture of an application screen with 
embedded IBM437 line 
drawing characters.
4. Opening cp437.html with encodings as above, the line drawing characters are 
displayed as 
expected.
5. However, a cat off mcc.log within a shellinabox VT100 terminal session gives 
a different 
result.

What is the expected output? 

See Screen shot 2009-11-23 at 5.53.01 PM.png

What do you see instead?

See Screen shot 2009-11-23 at 5.59.57 PM.png

What version of the product are you using? On what operating system?

Built from 2.10.tar.gz source on CentOS 5.3

Please provide any additional information below.

Original issue reported on code.google.com by ste...@mbase.com.au on 23 Nov 2009 at 7:03

GoogleCodeExporter commented 8 years ago
Of course subject should be VT100 line drawing!

Original comment by ste...@mbase.com.au on 23 Nov 2009 at 7:04

GoogleCodeExporter commented 8 years ago
Don't try to play with the page's character encoding. ShellInABox already 
reports the 
correct character encoding to the browser and it makes sure to output 
everything in 
Unicode. If you manually override the character encoding in the browser, it 
either 
doesn't do anything, or really strange things will happen.

ShellInABox understands UTF-8, so the best way to output non-ASCII characters 
is by 
making your application encode them in UTF-8.

But if that is not an option, you can always send the appropriate escape codes 
to 
disable UTF-8 mode and to pick the code page that you want. In your case, that 
would be 
IBM437.

Try running this command prior to running your application:

  echo -ne '\033%@\033(U'

Original comment by zod...@gmail.com on 23 Nov 2009 at 8:18

GoogleCodeExporter commented 8 years ago
The echo escape sequence works on my CentOS virtual when I cat the mcc.log.

Thank you for the very prompt reply.

I will try the app in the office tomorrow.

Original comment by ste...@mbase.com.au on 23 Nov 2009 at 8:42

GoogleCodeExporter commented 8 years ago
I have deleted the attachments. Thanks again.

Original comment by ste...@mbase.com.au on 23 Nov 2009 at 8:43

GoogleCodeExporter commented 8 years ago
We have tried the app tonight using the escape sequences. All OK so far.

How difficult would it be to add the 132 col support including switching back 
and forth?

Original comment by ste...@mbase.com.au on 23 Nov 2009 at 12:04

GoogleCodeExporter commented 8 years ago
This is not entirely trivial to do, as most modern browsers don't applications 
to 
arbitrarily resize windows anymore.

And within standard HTML, there also is no easy way to request a font that is 
guaranteed to have a particular dimension.

But when using a WebKit based browser (e.g. Chrome or Safari), we have access 
to CSS 
transforms which allow us to scale arbitrary web content. I believe, on any of 
those 
browsers I could "squish" the font when switching from 80 to 132 column mode. 
It'll 
require a few more changes throughout the code, but I'll see what I can do when 
I 
have a little time to experiment.

Original comment by zod...@gmail.com on 23 Nov 2009 at 6:57

GoogleCodeExporter commented 8 years ago
Fixed in subversion.

Original comment by zod...@gmail.com on 26 Nov 2009 at 12:19

GoogleCodeExporter commented 8 years ago
Thanks. I am testing using ncurses demos and vttest. I will give a summary in 
the next few days.

Original comment by ste...@mbase.com.au on 26 Nov 2009 at 10:21