如何编码和解码非Ascii字符? [英] How to encode & decode non Ascii characters?

查看:87
本文介绍了如何编码和解码非Ascii字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个要在其中编码西班牙语文本的应用程序.但是问题在于,它没有对特殊字符进行编码,例如á,é,í,ó,ú,ü,Á,Á,É,Í,Ó,Ú,Ü,Ñ,ñ.我该怎么做?我想对西班牙文本进行编码/解码.

I am developing an application in which i want to encode the Spanish text. But the problem is that,it doesn't encode the special characters such as á, é, í, ó, ú, ü,Á, É, Í, Ó, Ú, Ü,Ñ,ñ . How can i do this?i want to encode-decode the spanish text.

推荐答案

好,我正在回答自己的问题,希望它将对某人有所帮助;在给定的字符串中打印西班牙语或任何其他非ASCII字符用其Unicode转义字符集替换所有非ASCII字符例如,用\ u00e1 代替然后只需打印字符串即可.

ok,I am answering my own question ,Hope it will help someone; to print spanish or any other non-ascii character in the given string replace all non-ascii characters by their unicode escape character set E.g repalce á by \u00e1 And then simply print the string.

string str="árgrgrgrááhhttá";
str=str.Replace("á", "\u00e1");

这篇关于如何编码和解码非Ascii字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆