UART echo back program

I tried the following test codes for sending data from PC to G120 development board COM1, and echo back the same data from G120 to PC.
But, all of the echo back data are DEC number as string instead of ASCII string.

For example, I open up TerraTerm, when sending “A” from PC to G120, G120 returned “65” (this is NOT number, this is 2bytes strings (0x36,0x35),)

using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.Threading;
using GHI.Pins;
using System.IO.Ports;
using System.Text;

namespace NETMFTest
    public class Program
        public static void Main()
            SerialPort UART = new SerialPort("COM1", 115200);

            int read_cnt = 0;
            byte[] rx_data = new byte[1];


            while (true)
                read_cnt = UART.Read(rx_data, 0, 1);

                if (read_cnt > 0)
                    string get_data = rx_data[0].ToString() +"\r\n";

                    byte[] buffer = Encoding.UTF8.GetBytes(get_data);

                    UART.Write(buffer, 0, buffer.Length);



I want to get the string.

Appreciate your help.

@ DraganaM - The following line converts a byte to two characters and of course appends the carriage return and line feed.

You could try adding the following above your while loop :

```cs] byte[] buffer = new byte[3] { 0, 13, 10 };[/code

Then just overwrite the first byte in the array with the received value, instead of always appending the cartridge return and line feed

```cs] buffer[0] = rx_data;[/code

Good luck!

I would try this:

Change this line:

To this:

```cs]get_data = new string(Encoding.UTF8.GetChars(rx_data)) + "\r\n";[/code

The problem has been resolved. Thank you very much.