惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 陈叙远

发现了lucene一个bug 介绍一下Hyper Estraier 关于密码管理,一个很好的思路 无ASPX文件部署(续) NO Stop的GUI 在c#中调用windows脚本的方法 - 陈叙远 - 博客园 .net中的魔字符串 - 陈叙远 - 博客园 有人对开发一个开发平台感兴趣吗? 用来整理桌面的jscript脚本 某知名软件公司的一道笔试题 令人困绕的timer 热烈庆祝第一次博客园&博客堂线下聚会圆满成功 hello customer & order----你是哪一级? 立即释放.net下的com组件 笔试题系列之四 java和c#语言上的一个不同之处 - 陈叙远 - 博客园 笔试题系列之三 笔试题系列之二 中秋佳节,献上笔试题一道,祝各位事业蒸蒸日上!
.netFramework1.1下创建文件几种方式的不同之处
陈叙远 · 2006-12-18 · via 博客园 - 陈叙远

using(StreamWriter sw = File.CreateText(@"d:\DefaultUTF8.txt"))
{
    sw.Write("私");
}

using(StreamWriter sw=new StreamWriter(@"d:\StreamUTF8.txt",
    false,System.Text.Encoding.UTF8))
{
    sw.Write("私");
}

using (System.IO.FileStream fs = System.IO.File.Create(@"d:\ByteUTF8.txt"))
{
    byte[] info = System.Text.Encoding.UTF8.GetBytes("私");
    fs.Write(info, 0, info.Length);
}

一直以来,我认为上面三种方式的结果是一样的没有差别,今天才知道不是那么回事
呵呵,觉得这个问题比较幼稚的可以不必往下看了

运行结果1、3是一样的,都是E7 A7 81
而2会多出一个ZERO WIDTH NO-BREAK SPACE,也就是EF BB BF
当我们需要通过Byte Order Mark来标示该文件的编码方式的时候,请使用方法2

以上同样适用于标明Big-Endian和Little-Endian的UNICODE