Closed se7en3 closed 8 years ago
on the ApiConnection.cs WriteCommand function,i have modified bytes Encoding,and it's resolved.
Original:byte[] bytes = Encoding.ASCII.GetBytes(row.ToCharArray()); modified :byte[] bytes = Encoding.GetEncoding("GB2312").GetBytes(row.ToCharArray());
Support for read/write encoding added. See ITikConenction.Encoding.
I guess I should have looked here sooner. But it is fixed now so whatever.
Just wondering why you are using ASCII by default, but since you were nice enough to make it a property like boen_robot suggested it doesn't matter.
ASCII is default for mikrotik console :-) I have added comment to forum to help other people to use thei custom encodings ...
D
on the ApiConnection.cs ReadWord function,i can't get chinese. and i fixed it use this
byte[] byteArray=new byte[wordLength];
for (int i = 0; i < wordLength; i++)
{
byte readByte = (byte)_tcpConnectionStream.ReadByte();
byteArray[i] = readByte;
}
result = Encoding.GetString(byteArray);
when i want to add a ip pool, use Chinese word like name=“北京” ,but it's result is "??" on the mikrotik ROS
var com = connection.CreateCommand("/ip/pool/add"); com.AddParameter("name", "北京"); com.AddParameter("ranges", "10.1.135.3");