Symptom:
Call with C # EncodingSMSA cat sends a text message containing Chinese characters, but it always receives Garbled text messages or question marks (?), The use of default, Unicode-16 and Other encoding methods are still invalid, and other non-Chinese characters can be normally received.
In addition, you can directly enter the AT command in the Super Terminal to send both Chinese and English messages.
I am using a SMS cat with a TC35 chip.
SolutionProcess:
Not all. Net projects will see this situation. After VC ++ and VB are compiledProgramThis is not the case for execution.
Therefore, we should write a Win32 dynamic library to encapsulate the short message sending and calling, and then call this dynamic library in the. NET project.
The main steps are as follows,
1. Create a dynamic connection library using vc6.0 and select File> new. The new dialog box is displayed. On the projects tab, select "Win32 dynamic-Link Library ". Create an empty dynamic library project and remember the name tc35.
2. Add a. cpp file and name it as needed. Note that dynamic libraries cannot be generated without this file.
Define your own functions
Int mysendmsg (INT iport, char * smsg, char * sphone)
{
//-Send Short Message
Return sendmsg (iport, smsg, sphone, 1, true );
}
3. Add a. Def file with the suffix
Copy the followingCodeNote that the Library is followed by the name of the dynamic library (the name of the dynamic library project)
Library TC35
Description 'my tc35dll'
Exports
Mysendmsg
4. Reference static Connection Library: ascendsms. Lib
5. Compilation successful
6. Declare in C,
[Dllimport ("tc35.dll")]
Public static extern int mysendmsg (INT iport, string smsg, string sphone );