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.UTF8
System.Text.Encoding.UTF16
System.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# 中多线程网络服务器的模式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01