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

推荐订阅源

Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
T
The Blog of Author Tim Ferriss
博客园 - 叶小钗
N
Netflix TechBlog - Medium
腾讯CDC
C
Check Point Blog
P
Proofpoint News Feed
Engineering at Meta
Engineering at Meta
GbyAI
GbyAI
S
SegmentFault 最新的问题
F
Fortinet All Blogs
美团技术团队
U
Unit 42
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 司徒正美
F
Full Disclosure
Recorded Future
Recorded Future
D
DataBreaches.Net
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
J
Java Code Geeks
I
InfoQ
Y
Y Combinator Blog
A
About on SuperTechFans
AI
AI
爱范儿
爱范儿
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Forbes - Security
Forbes - Security
W
WeLiveSecurity
M
MIT News - Artificial intelligence
雷峰网
雷峰网
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
Schneier on Security
Schneier on Security
The GitHub Blog
The GitHub Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Know Your Adversary
Know Your Adversary
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Docker
Recent Commits to openclaw:main
Recent Commits to openclaw:main
量子位
V2EX - 技术
V2EX - 技术
Project Zero
Project Zero

博客园 - dahai.net

常用的DOCUMENT.EXECCOMMAND WebForm中的tip - dahai.net - 博客园 修改所有用户表/存储过程/视图/触发器/自定义函数的所有者为dbo,则用游标(不要理会错误提示) 在无锡办理10万元注册资本的企业,所需要时间和费用 Win 2003下无敌权限提升方法(转) ftp讨论站连接 使用.NET实现断点续传 使用WMI创建站点和虚拟目录,并设置属性 - dahai.net - 博客园 千万数据翻页解决方案 CHM格式解析 从互联网加载图片到PictureBox1 Visual Studio .NET已检测到指定的Web服务器运行的不是ASP.NET 1.1 版 - dahai.net [分享]千万数量级分页存储过程(带效果演示)(转) 网站分析专用名词 列出sqlserver数据库孤立用户 写数据到文件 - dahai.net - 博客园 网页模糊归类算法的应用与实现 搜索引擎的实现原理 一种快速的未登陆词识别方法(原理和实现)
总结字符串编码(转)
dahai.net · 2005-12-29 · via 博客园 - dahai.net

这几个月作手机短信的项目,碰到了很多字符编码的问题,真头痛。经过多番资料的搜索、亲手尝试和高人的指点,现在好像没那么迷惘了。现作了一些总结跟大家分享(有误之处请指点)

  首先应该把字节数组看成是String的载体。
  dot Net使用的字符串String是Unicode编码的;它也是以Unicode编码的形式显示字符串。

  以下是用自己语言对几个常用函数的说明:
  (自己总结的,反正看不明MSDN)
  bytes=System.Text.Encoding.Unicode.GetBytes(str)
  作用:把str的载体作Unicode->Unicode的编码转换--也就是没有对载体作任何的转换。因些使用此函数可以得代表该String载体的字节数组。
  str=System.Text.Encoding.Unicode.GetString(bytes)
  作用:对字节数组作Unicode->Unicode的编码转换--即没有转换,把经过转换后的字节数组作为str的载体。

  bytes=System.Text.Encoding.Utf8.GetBytes(str)
  作用:把str的载体作Utf8->Unicode的编码转换。返回的是经过转换后的字符数组
  str=System.Text.Encoding.Utf8.GetString(bytes)
  作用:对字节数组作Gb2312->Unicode的编码转换,把经过转换后的字节数组作为str的载体。

  bytes=System.Text.Encoding.GetEncoding("GB2312").GetBytes(str)
  作用:把str的载体作Gb2312->Unicode的编码转换。返回的是经过转换后的字符数组
  str=System.Text.Encoding.GetEncoding("GB2312").GetString(bytes)
  作用:对字节数组作Gb2312->Unicode的编码转换,把经过转换后的字节数组作为str的载体。

如此类推
  bytes=System.Text.Encoding.GetEncoding("XXX").GetBytes(str)
  作用:把str的载体作XXX->Unicode的编码转换。返回的是经过转换后的字符数组
  str=System.Text.Encoding.GetEncoding("XXX").GetString(bytes)
  作用:对字节数组作XXX->Unicode的编码转换,把经过转换后的字节数组作为str的载体。

这里是我收集的一些有关字符编码的资料:http://61.145.116.154/bm/
还有:
http://www.unicode.org/charts/unihan.html
根据Unicode编码查其对应字符的字形、Utf8、汉字区位码等
http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/GB/GB2312.TXT Unicode与Gb2312的对照表
http://www.sun.com/developers/gadc/technicalpublications/articles/mabiao.txt
Unicode与Gbk对照表