您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 巴音郭楞蒙古分类信息网,免费分类信息发布

详解C#把UNICODE编码转换为GB编码的示例代码

2025/2/9 20:31:03发布4次查看
下面小编就为大家带来一篇c#把unicode编码转换为gb编码的实例。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧
实例如下:
public string unicodetogb(string text) { system.text.regularexpressions.matchcollection mc = system.text.regularexpressions.regex.matches(text, "\\\\u([\\w]{4})"); if (mc != null && mc.count > 0) { foreach (system.text.regularexpressions.match m2 in mc) { string v = m2.value; string word = v.substring(2); byte[] codes = new byte[2]; int code = convert.toint32(word.substring(0, 2), 16); int code2 = convert.toint32(word.substring(2), 16); codes[0] = (byte)code2; codes[1] = (byte)code; text = text.replace(v, encoding.unicode.getstring(codes)); } } else { } return text; }
以上就是详解c#把unicode编码转换为gb编码的示例代码的详细内容。
巴音郭楞蒙古分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录