如何使用.net 1.1将字符串变量转换为二进制数据变量?
我找到了一种方法:
ASCIIEncoding^ ascii = gcnew ASCIIEncoding;
String^ unicodeString = L"This Unicode String* contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3).";
array<Byte>^ binaryData = ascii->GetBytes( unicodeString );
答案 0 :(得分:1)
这个怎么样?
byte[] InputbyteArray = Encoding.UTF8.GetBytes(inputString);
string B64String = Convert.ToBase64String(InputbyteArray)
答案 1 :(得分:1)
在.NET 1.1中,您只能访问损坏的Managed Extensions for C ++编译器。它坏了,你不应该使用它。
然而,IIRC,语法将类似于:
System::Byte bytes __gc[] = Encoding::ASCII::GetBytes(inputString);
System::String __gc* base64string = Convert::ToBase64String(bytes);