编码是将一组 Unicode 字符转换为一个字节序列的过程。 Encoding is the process of transforming a set of Unicode characters into a sequence of bytes. ' This Unicode string has 2 characters outside the ASCII range: ' The example displays the following output: ' Open the file as a binary file and decode the bytes back to a string.įs = new FileStream(".\UTF8Encoding.txt", FileMode.Open)ĭim decodedString As String = utf8.GetString(bytes) String^ unicodeString = L"This Unicode string has 2 characters " +Īrray^ encodedBytes = utf8->GetBytes(unicodeString ) Ĭonsole::Write( " bytes to the file.", fs.Length)ĭim sr As New StreamReader(".\UTF8Encoding.txt")Ĭonsole.WriteLine("String read using StreamReader:") A Unicode string with two characters outside an 8-bit code range. 编码的字节数组解码为字符串后,Pi 和 Sigma 字符仍然存在。 When the encoded byte array is decoded back to a string, the Pi and Sigma characters are still present. Unicode 字符串包含两个字符,Pi (U + 03A0) 和 Sigma (U + 03A3) ,它们在 ASCII 字符范围外。 The Unicode string includes two characters, Pi (U+03A0) and Sigma (U+03A3), that are outside the ASCII character range. 下面的示例使用 UTF8Encoding 对象对 Unicode 字符串进行编码,并将其存储在字节数组中。 The following example uses a UTF8Encoding object to encode a string of Unicode characters and store them in a byte array. ![]() SerializableAttribute ComVisibleAttribute 示例
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |