csharp: Converting chinese character to Unicode
Function chinese2unicode(Str)
Dim Str_one:Str_one = ""
Dim Str_unicode:Str_unicode = ""
For i = 1 To Len(Str)
Str_one = Mid(Str, i, 1)
If AscW(Str_one) < 0 or AscW(Str_one) > 255 Then
Str_unicode = Str_unicode & Chr(38)
Str_unicode = Str_unicode & Chr(35)
Str_unicode = Str_unicode & Chr(120)
Str_unicode = Str_unicode & Hex(AscW(Str_one))
Str_unicode = Str_unicode & Chr(59)
Else
Str_unicode = Str_unicode & Str_one
End If
Next
chinese2unicode=Str_unicode
End Function
/// <summary>
/// %26%23x4EB2%3B%26%23x7231%3B%26%23x7684%3B%26%23x4F1A%3B%26%23x5458%3BTeresaLiu%2C%26%23x516D%3B%26%23x798F%3B%26%23x73E0%3B%26%23x5BF6%3B%26%23x6703%3B%26%23x54E1%3B%26%23x5BC6%3B%26%23x78BC%3B%26%23x4FEE%3B%26%23x6539%3B%26%23x9805%3B%26%23x901A%3B%26%23x77E5%3B%26%23xFF1A%3B%26%23x95A3%3B%26%23x4E0B%3B%26%23x5DF2%3B%26%23x6210%3B%26%23x529F%3B%26%23x66F4%3B%26%23x6539%3B%26%23x5BC6%3B%26%23x78BC%3B%26%23xFF0C%3B%26%23x5982%3B%26%23x6709%3B%26%23x67E5%3B%26%23x8A62%3B%26%23xFF0C%3B%26%23x8ACB%3B%26%23x81F4%3B%26%23x96FB%3B%26%23x9999%3B%26%23x6E2F%3B27109368%26%23xFF0F%3B%26%23x4E2D%3B%26%23x570B%3B4008846222
///塗聚文 20140724
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
private string chinese2uncode(string str)
{
string s = "";
string outStr = "";
if (!string.IsNullOrEmpty(str))
{
for (int i = 0; i < str.Length; i++)
{
if (Microsoft.VisualBasic.Strings.AscW(str[i].ToString()) < 0 || Microsoft.VisualBasic.Strings.AscW(str[i].ToString())>255) //如果是中文转换Regex.IsMatch(str[i].ToString(), @"[\u4e00-\u9fa5]")
{
//outStr += "\\u" + ((int)str[i]).ToString("x");
outStr = outStr+(char)38;// "&";//char(38);
outStr = outStr + (char)35;// "#";
outStr = outStr + (char)120;// "x";
outStr = outStr + Microsoft.VisualBasic.Conversion.Hex(Microsoft.VisualBasic.Strings.AscW(str[i].ToString())); //outStr +
outStr = outStr + (char)59;// ";";
//Str_unicode = Str_unicode & Chr(38)
//Str_unicode = Str_unicode & Chr(35)
//Str_unicode = Str_unicode & Chr(120)
//Str_unicode = Str_unicode & Hex(AscW(Str_one))
//Str_unicode = Str_unicode & Chr(59)// ; }
else
{
outStr += str[i];
} }
}
s = outStr;
return s;
}
csharp: Converting chinese character to Unicode的更多相关文章
- IEF could not decode Chinese character in IE history well
My friend is working on some case, and she looks not in the mood. I ask her what's going on. She wan ...
- EnCase v7 could not recognize Chinese character folder names / file names on Linux Platform
Last week my friend brought me an evidence file duplicated from a Linux server, which distribution i ...
- GitHub & puppeteer & Chinese character & bug
GitHub & puppeteer & Chinese character & bug https://github.com/GoogleChrome/puppeteer/b ...
- Unicode Character Table – Unicode 字符大全
Unicode(统一码.万国码.单一码)是一种在计算机上使用的字符编码.它为每种语言中的每个字符设定了统一并且唯一的二进制编码,以满足跨语言.跨平台进行文本转换.处理的要求.Unicode Chara ...
- (Android) Chinese Character
Convert Chinese strings to English strings Apply pinyin4j.jar public static class ConvertChineseToPi ...
- Multi-Byte Character Set & Unicode Character Set
本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/49592361 编程时遇到BUG:err ...
- 汉字转拼音再转ASCII
汉字能够转成拼音.能够在转成ASCII码,然后就能够转成十六进制数,再就能够转成0和1组成的二进制帧了! 比方说: 我爱你 -> wo ai ni -> 119 111 32 97 105 ...
- solr入门之pinyin4j源代码改写动态加入扩展词及整合进war项目中
1.初始化时载入用户定义的字典 package net.sourceforge.pinyin4j; import net.sourceforge.pinyin4j.multipinyin.Trie; ...
- ApkToolBoxGUI 0.0.8发布了!!
https://github.com/jiangxincode/ApkToolBoxGUI APKToolBoxGUI是一个程序员常用的小工具合集,有个比较友好的交互界面.主要包含编码转换,时间戳转换 ...
随机推荐
- css里面鼠标的形状-----》easyui哪点事
用css控制鼠标样式的语法如下:<span style="cursor:*">文本或其它页面元素</span>把 * 换成如下15个效果的一种: 下面是对这 ...
- Ionic开发Hybrid App问题总结
http://ionichina.com/topic/5641b891b903cba630e25f10 http://www.cnblogs.com/parry/p/issues_about_buil ...
- 【算法】C++用链表实现一个箱子排序附源代码详解
01 箱子排序 1.1 什么是分配排序? 分配排序的基本思想:排序过程无须比较关键字,而是通过"分配"和"收集"过程来实现排序.它们的时间复杂度可达到线性阶:O ...
- P2057 [SHOI2007]善意的投票 最小割
$ \color{#0066ff}{ 题目描述 }$ 幼儿园里有n个小朋友打算通过投票来决定睡不睡午觉.对他们来说,这个问题并不是很重要,于是他们决定发扬谦让精神.虽然每个人都有自己的主见,但是为了照 ...
- BFS - 20190206
1.二叉树 BFS 2.拓扑排序 重点 BFS 3.棋盘上的宽搜 BFS 图的遍历 层级遍历,由点及面,拓扑排序,简单图的最短路径 如果题目问最短路径:可能是BFS或者DP, 最长路径:DFS q ...
- 2019.4.9 HTML+CSS写静态百度首页
静态百度首页 4.10更新 更改所有样式为内部引入 换行全部换成使用边距实现 链接:https://pan.baidu.com/s/1iFNnQNw4PUtdj3MjlV-LZA 提取码:5b2i
- V1-bug Alpha阶段项目展示
V1-bug Alpha阶段项目展示 团队成员简介 Name Summary Sefie wxmwy V1-bug制造公司资深工程师精通各种抱大腿方式团队吉祥物 182 面面俱到流派一丝不苟 Powe ...
- 关于浏览器localhost点击wamp项目跳转出错
www目录下index.php399行代码 $handle=opendir("."); $projectContents = ''; while (($file = readdir ...
- mybatis映射文件模板mapper.xml格式
1.定义基础的映射 对象DO与数据库字段间的映射 <resultMap id="UserResult" type="UserDO"> <res ...
- A problem has been detected and windows has been shut down to prevent damage
问题描述 问题解决 参考百度经验, 未解决,重装系统,U盘启动解决.过程可以参考上一篇博文.