是否有任何等效的 C/C 函数 IdnMapping::GetAscii C# Methode
Is there any equivalent C/C function of IdnMapping::GetAscii C# Methode?
我正在尝试在Wince 6.0中将C#代码实现到C/C++中(无需安装.NET Framework)。
在此 C# 代码中,使用了方法 IdnMapping::GetAscii,它也需要在 C/C++ 中转换。http://msdn.microsoft.com/en-us/library/system.globalization.idnmapping.getascii.aspx
an eqıivalent fonction to IdnMapping::GetAscii is need..
谢谢 小费和帮助 =)
问候。。
你可以试试这个:
- 获取字符串的长度
- 使用输入的第一个元素上的指针初始化新的 Unicode 字符串
-
字符串中的每个符号创建一个static_cast并将其复制到您的 ASCII 字符串中
char* GetASCII(const wchar_t* wstr){ int count = wcslen(wstr); 字符* ASCII = 新字符[计数 + 1];
wchar_t* pwchr = const_cast<wchar_t*> (&wstr[0]); for(int j = 0; j < count; ++j) { ascii [j] = static_cast<char> (*pwchr); pwchr++; } ascii [count] = ' '; return ascii ;
}
"ascii" 字符串在 punycode 中。
因此,您需要查找用于 punycode 转换的示例代码,例如 https://www.example-code.com/cpp/punycode.asp