[英]Code to convert Unicode to ASCII
我正在尋找將Unicode轉換為7位ASCII的代碼。 有什么建議么?
如果使用utf-8編碼,則ascii和unicode都是一樣的,因為ascii是unicode的子集。 請參閱RFC 2044中的示例
下面是一個簡單的示例:
try
{
System.IO.TextWriter writeFile = new StreamWriter("c:\\textwriter.txt",false,Encoding.UTF7);
writeFile.WriteLine("example text here");
writeFile.Flush();
writeFile.Close();
writeFile = null;
}
catch (IOException ex)
{
MessageBox.Show(ex.ToString());
}
我建議將代碼從glib C函數g_str_to_ascii()
為C ++:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.