What#39;s the difference between UTF8/UTF16 and Base64 in terms of encoding(UTF8/UTF16和Base64在编码方面有什么区别)
问题描述
在.c#
我们可以使用以下类进行编码:
We can use below classes to do encoding:
System.Text.Encoding.UTF8System.Text.Encoding.UTF16System.Text.Encoding.ASCII
为什么没有System.Text.Encoding.Base64?
我们只能使用Convert.From(To)Base64String方法,base64有什么特别之处?
We can only use Convert.From(To)Base64String method, what's special of base64?
我能说base64和UTF-8是一样的编码方式吗?或者 UTF-8 是 base64 之一?
Can I say base64 is the same encoding method as UTF-8? Or UTF-8 is one of base64?
推荐答案
UTF-8 和 UTF-16 是将 Unicode 字符串编码为字节序列的方法.
UTF-8 and UTF-16 are methods to encode Unicode strings to byte sequences.
请参阅:每个软件开发人员绝对、肯定必须了解 Unicode 和字符集的绝对最低要求(没有借口!)一个>
Base64 是一种将字节序列编码为字符串的方法.
Base64 is a method to encode a byte sequence to a string.
因此,这些是截然不同的概念,不应混淆.
So, these are widely different concepts and should not be confused.
注意事项:
并非每个字节序列都代表以 UTF-8 或 UTF-16 编码的 Unicode 字符串.
Not every byte sequence represents an Unicode string encoded in UTF-8 or UTF-16.
并不是每个 Unicode 字符串都代表一个用 Base64 编码的字节序列.
Not every Unicode string represents a byte sequence encoded in Base64.
这篇关于UTF8/UTF16和Base64在编码方面有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UTF8/UTF16和Base64在编码方面有什么区别
基础教程推荐
- C# 从 List<List<int>> 中删除重 2022-01-01
- 当值可以是对象或空数组时反序列化 JSON 2022-01-01
- 如果有人提交恶意软件Nuget包怎么办? 2022-01-01
- WPF 模态进度窗口 2022-01-01
- .NET SerialPort DataReceived 事件未触发 2022-01-01
- Azure Functions:CosmosDBTrigger 未在 Visual Studio 中触发 2022-01-01
- 禁止输入少量字符,例如'<'、'&a 2022-01-01
- 如何使用 .Net 检查 Active Directory 服务器是否已启动并正在运行? 2022-01-01
- 我应该在后面的代码中直接使用 Linq To SQL 还是使 2022-01-01
- Moq It.Is<>不匹配 2022-01-01
