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在编码方面有什么区别


基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 将 XML 转换为通用列表 2022-01-01