Chinese garbled characters in text messages sent by SMS cats under ASP. NET

Source: Internet
Author: User

 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 );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.