C# Unicode string output

前端 未结 3 600
误落风尘
误落风尘 2020-11-27 07:34

I have a function to convert a string to a Unicode string:

private string UnicodeString(string text)
{
    return Encoding.UTF8.GetString(Encoding.ASCII.GetB         


        
3条回答
  •  粉色の甜心
    2020-11-27 07:41

    private string UnicodeString(string text)
    {
        return text;
    }
    

    The string text is already in Unicode. All internal C# strings are Unicode. When you convert it to ASCII you lose characters. That is why you get ????? ????.

提交回复
热议问题