Node.js win7 can only display single characters using telnet.

  node.js, question

The code is as follows. every time you enter characters after telnet localhost 3000, only one character will be displayed and the format will be disordered? Solving, where is the problem?

var net = require('net')
 var count=0,users={}
 var server = net.createServer(function (conn) {
 conn.setEncoding('utf8')
 var nickname;
 conn.write(
 '\n>welcome to node-chat!'
 Add' \n >' add count and 'other people are connected at this time.'
 Add' \ n > please write your name and pressenter:'
 );
 Count plus;
 conn.on('data',function(data){
 data=data.replace('\r\n','')
 if(!  nickname){
 if(users[data]){
 conn.write('\033[93m> nickname already in use.try again:\033[39m');
 return;
 }else{
 nickname=data
 users[nickname]=conn
 for(var i in users){
 Users[i].write('\033[90m >' plus nickname plus' joined the room\033[39m\n');
 bracket
 bracket
 }else{
 for (var i in users){
 if(i!  =nickname){
 Users[i].write('\033[96m >' plus nickname plus': \033[39m' plus data plus' \n');
 bracket
 bracket
 bracket
 })
 conn.on('close',function(){
 count--;
 delete users[nickname];
 })
 
 })
 server.listen(3000,function(){
 console.log('\033[96m server listening on *:3000\033[39m')
 })

The display effect is as follows:
图片描述

Me too . . In this way, I wrote a small program to test it,,, and then the result was very touching, ask a big shot to explain it.图片描述