0 votes
by (120 points)
closed by

Chinese characters are not rendering correctly with TerminalControl in C# winForm

There is a problem with the display of Chinese characters. The words are all contracted together. It seems that each Chinese character only occupies half the width.

Rebex.Terminal.Control, Version=7.0.9048.0

mycode:

// create a new Ssh client object
var ssh = new Rebex.Net.Ssh();
_ssh.Encoding = Rebex.EncodingTools.UTF8;
// connect to the SSH server
_ssh.Connect(SqLiteUtil.LinuxSetting.Host, int.Parse(SqLiteUtil.LinuxSetting.Port));
// login to the SSH server
_ssh.Login(SqLiteUtil.LinuxSetting.Sa, SqLiteUtil.LinuxSetting.Passwd);
//
ssh.RunCommand("export TERM=xterm");

//set utf8
terminalControl.Options.Encoding = Rebex.EncodingTools.UTF8;
terminalControl.Options.FunctionKeysMode = FunctionKeysMode.Linux;

// 1.changes the default selection mode to block mode
// terminalControl.SelectionMode = TextSelectionMode.Block;
// 2.specifies whether the right mouse button pastes text from clipboard
// terminalControl.MousePasteEnabled = true;
// 3.specifies whether selection a text using a mouse automatically copies the selected text into clipboard
// terminalControl.MouseSelectionCopiesToClipboard = true;
//set font
terminalControl.AutoAdjustTerminalSize = true;
terminalControl.Palette = TerminalPalette.Dos;

//terminalControl.TerminalFont = TerminalFont.FromDosFont(fontByte);
terminalControl.TerminalFont = new Rebex.TerminalEmulation.TerminalFont(FontUtil.LoadFontFamily(), 12.00f);
terminalControl.Font= new Font(FontUtil.LoadFontFamily(), 12.00f);

//terminalControl.TerminalFont = new Rebex.TerminalEmulation.TerminalFont("Consolas", 12.00f);
Size cellSize = terminalControl.CellSize;
// bind the connected and authenticated Ssh instance to the terminal console

terminalControl.Bind(_ssh);
terminalControl.Screen.WriteLine($"{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")} Session connected.");

closed with the note: It will gain support in the 8th version.

1 Answer

0 votes
by (148k points)

This is almost certainly caused by lack of support for double-width characters in Rebex terminal controls.

We are aware of this limitation, and plan to add support for it, but so far we have been busy adding other features. We will look into this and see whether it's feasible to add this to the forthcoming version 8!

by (120 points)
it's a good news,tks
...