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是一个程序员常用的小工具合集,有个比较友好的交互界面.主要包含编码转换,时间戳转换 ...
随机推荐
- Laravel for Windows 开发环境配置
本文为CSDN Choris 原创,转载请事先征得作者同意,以示尊重! 原文:http://blog.csdn.net/choris/article/details/50215835 Laravel配 ...
- es-curl 查询与更新
1,封装http方法 private function http($url, $data = NULL, $json = false) { unset($res,$curl,$errorno); $c ...
- [集合]Collection集合框架源码分析
Collection接口 在java的集合类库中,基本接口是Collection,该接口的在集合中的源码定义如下(将源码中的注释删掉了): public interface Collection< ...
- 提交app时候遇到IDFA警告
1.最近提交app时候遇到如下问题,解决方案: Everything has come to its usual state now. Simply upload your binary as you ...
- ElasticSearch 因为磁盘空间不够引起的数据插入错误。(message [ClusterBlockException[blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];]])
ES升级到624测试从Kettle插入数据的时候,经常提示如下错误 message [ClusterBlockException[blocked by: [FORBIDDEN/12/index rea ...
- 批量自动化生成PDF目录标签
所需软件: 1. FreePic2Pdf(网上很容易找到) 2. python3 3. 天若OCR 链接:https://pan.baidu.com/s/1B9dUr3gc0pv0BSHo5QYGsQ ...
- 使用IntelliJ IDEA 前最好修改的配置
目录 1.下载 2.破解 3.修改配置 下载 详见我的另外一篇博客:<软件开发资源下载>中的[IDE]->[IntelliJ IDEA] 破解 详见我的另外一篇博客:<最新版I ...
- POJ_3264 Balanced Lineup 【线段树 + 区间查询】
一.题面 POJ3264 二.分析 典型的线段树的题,没有更新只有查询. 查询的时候需要注意的是,在判断区间是完全属于右子树还是左子树时,要根据建树的情况来选择,不然会出错.具体看代码 三.AC代码 ...
- 论文阅读 | ExtremeNet:Bottom-up Object Detection by Grouping Extreme and Center Points
相关链接 论文地址:https://arxiv.org/abs/1901.08043 论文代码:https://github.com/xingyizhou/ExtremeNet 概述 ExtremeN ...
- Win32创建异形窗口
大家都见过在windows下各种气泡窗口.输入法窗口以及其他一些窗口,这些窗口看起来不像传统的windows窗那样,上面是标题栏,下面是窗口的客户区.这些窗口形状各异,可以是一个多边形,一幅图,甚至是 ...