Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > General


Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 11-10-2015, 12:48 AM
seesea's Avatar
seesea seesea is offline
Registered User
Join Date: Jun 2010
Posts: 20
Question Unable to input Chinese character on the telnet connection

Hi, I have a problem about input Chinese character, when using protocol "telnet" and encoding "GBK" to connect to servers which should support GBK, a server's connection can input Chinese character correctly, another one can't. I don't know why, any body can help me? Thand you. Here is a test below:

My system is windows XP SP3, SecureCRT's version is "Version 7.1.3 (build 378) - Official Release".
There is a server writen in php which encoding in ascii, I can type in the Chinese character correctly when I connect to the server using the system's telnet command, while using SecureCRT for connecting, the character become messy code. The screenshot below shows that my input in SecureCRT is "CRT客户端", but SecureCRT said that "You are a donkey!" :'( (a joke), it showed "CRT驴突搂露", and the server got the string "CRT驴突搂露"; Then I tested using the system's telnet command, everything is OK. Both clients' encoding is "ANSC/OEM - 简体中文 GBK". I tried different encodings and fonts, and different Chinese IME, but all didn't work.

The test using a php server which's code is below, and saved with encoding in ascii:
PHP Code:
// 确保在连接客户端时不会超时

$ip '';
$port 3333;

 *    @socket通信整个过程
 *    @socket_create
 *    @socket_bind
 *    @socket_listen
 *    @socket_accept
 *    @socket_read
 *    @socket_write
 *    @socket_close

/*----------------    以下操作都是手册上的    -------------------*/
if (($sock socket_create(AF_INET,SOCK_STREAM,SOL_TCP)) == false) {
"socket_create() 失败的原因是:".socket_strerror(socket_last_error())."\n");

if ((
$ret socket_bind($sock,$ip,$port)) == FALSE) {
"socket_bind() 失败的原因是:".socket_strerror(socket_last_error())."\n");

if ((
$ret socket_listen($sock)) < 0) {
"socket_listen() 失败的原因是:".socket_strerror(socket_last_error())."\n");

$count 0;

do {
    if ((
$msgsock socket_accept($sock)) < 0) {
"socket_accept() failed: reason: " socket_strerror($msgsock) . "\n";
    } else {
// 发到客户端
$msg ="连接成功!\n";

$buf socket_read($msgsock,8192,PHP_NORMAL_READ);

$talkback "收到的信息:$buf\n";

        if (++
$count >= 5){
//echo $buf;
} while (

I find out it works fine when the php server's file saved in UTF-8 and the SecureCRT's encoding in UTF-8, but the real server is a third party's, I can't change it. So I have to use SecureCRT with encoding "GBK".

But on the other hand, SecureCRT's connection to another third party's server works fine when using the "GBK" encoding, the screenshort shows below:

Can you help me to point out how can I input Chinese character on the telnet connection to the php server encoding in ascii using SecureCRT with the encoding "GBK"?
Thank you!

Last edited by seesea; 11-10-2015 at 03:27 AM. Reason: edit php code
Reply With Quote

chinese , gbk , telnet

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 02:36 AM.