why I get just numbers in UCS2 how can I fixed at commands and c#?

前端 未结 2 1661
独厮守ぢ
独厮守ぢ 2021-01-16 06:12

I am having a problem with reading my sms through putty, Its beacuse I type AT+CMGL=\"ALL\" but the message(text) and number are just numbers, I read that my gms modem nokia

2条回答
  •  既然无缘
    2021-01-16 06:52

    To convert from the UCS-2 encoding store the result (input) in a byte array instead of a string and then call

    System.Text.Encoding enc =  Encoding.Unicode;
    string myString = enc.GetString(myByteArray);
    

    If the UCS-2 encoding is Big Endian then change System.Text.Encoding enc = Encoding.Unicode; to System.Text.Encoding enc = Encoding.BigEndianUnicode;.

    Related resources include:

    • Unicode and .NET
    • C# big-endian UCS-2

提交回复
热议问题