array<Byte> ^RxData = gcnew array<Byte>(2);
	RxData[0] = 'A';
	RxData[0] = 'B';
	String ^sTemp;

	sTemp = System::Text::Encoding::UTF8->GetString(RxData);

N.B. Make the array the length of the string – do not use a 0x00 terminating byte. If you do you get a resulting string but you can't add any new characters to it (e.g. MyString += "abc") because the null has been taken into it. You can use this to remove them:

	sTemp = sTemp->Replace("\0", "");

Converting A Single Char / Byte

	Byte Value = 0x31;
	SomeString += (Char)Value;		//<<Note the capital C

Alternative method - convert it to an array (a silly solution but it works!)

	array<Byte> ^ch = gcnew array<Byte>(1);
	ch[0] = Convert::ToByte(SomeString[i]);
	SomeString += System::Text::Encoding::UTF8->GetString(ch);

Removing Nulls In A String

	SomeString = SomeString->Replace("\0", "");
Feel free to comment if you can add help to this page or point out issues and solutions you have found. I do not provide support on this site, if you need help with a problem head over to stack overflow.


Your email address will not be published. Required fields are marked *