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# 9 新特性——record的相关总结 2023-04-03
- 从 C# 控制相机设备 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 将数据集转换为列表 2022-01-01
- 如果条件可以为空 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
