SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Sun May 19, 2024 18:07
SMSTools3 Community » Search Bottom

Page:  1

Keywords:
Mode: All keywords (AND)
hankchan: keke,thank you very much . i have solve the problem ,and i will try your script later . i did it as follow: #include <stdlib.h> #include <iostream> #include <fstream> #include <exception> #include <string.h> #include <locale.h> #define SMS_MSG_ONE_CHAR_LENGTH 70 #define SMS_MSG_PER_CHAR_LENGTH 65 #define SMS_MSG_MAX_CHAR_LENGTH 585 //Alphabet values: -1=GSM 0=ISO 1=binary 2=UCS2 #define SMS_ALPHABET_GSM -1 #define SMS_ALPHABET_ISO 0 #define SMS_ALPHABET_BINARY 1 #define SMS_ALPHABET_UCS2 2 using namespace std; int sms_alarm_send(char* fileName,char* to,char* msg,int Alphabet=SMS_ALPHABET_UCS2) { int len = 0; char smsHeader[128]; wchar_t buffer[SMS_MSG_MAX_CHAR_LENGTH]; char smsBody[SMS_MSG_MAX_CHAR_LENGTH*2]; std::ofstream outfile (fileName,ofstream::binary); memset(smsHeader,0,sizeof(smsHeader)); len += sprintf(smsHeader+len,"%s%s\n","To: ",to); switch (Alphabet) { case SMS_ALPHABET_GSM: len += sprintf(smsHeader+len,"%s\n\n","Alphabet: GSM"); break; case SMS_ALPHABET_ISO: len += sprintf(smsHeader+len,"%s\n\n","Alphabet: ISO"); break; case SMS_ALPHABET_BINARY: len += sprintf(smsHeader+len,"%s\n\n","Alphabet: BIN"); break; case SMS_ALPHABET_UCS2: len += sprintf(smsHeader+len,"%s\n\n","Alphabet: UCS"); break; default: break; } setlocale(LC_ALL,"zh_CN.gb18030"); memset(buffer,0,sizeof(buffer)); memset(smsBody,0,sizeof(buffer)); mbstowcs (buffer,msg,SMS_MSG_MAX_CHAR_LENGTH); for(int i=0; i<wcslen(buffer); i++){ smsBody[2*i]=buffer >> 8; smsBody[2*i+1]=buffer & 0xff; } setlocale( LC_ALL, "C"); outfile.write(smsHeader,strlen(smsHeader)); outfile.write((char*)smsBody,wcslen(buffer)*2); outfile.close(); return 0; } int main(int argc,char* argv[]) { std::cerr << "Setting sms_alarm_send\n"; char to[] = "86135********"; // pure chinese sms_alarm_send("test11.sms",to,"11.你好,测试短信"); sms_alarm_send("test12.sms",to,"12.你好,测试短信",SMS_ALPHABET_ISO);//error Alphabet // mix with chinese and english sms_alarm_send("test21.sms",to,"21.你好,测 hello试短信,hello,123"); sms_alarm_send("test22.sms",to,"22.你好,测 hello试短信,hello,123",SMS_ALPHABET_ISO);//error Alphabet // pure english sms_alarm_send("test31.sms",to,"31.hello,test"); sms_alarm_send("test32.sms",to,"32.hello,test",SMS_ALPHABET_ISO); std::cerr << "sms_alarm_send finish\n"; return 1; }
hankchan: this is the test sms file : root@hankchan-server:/home/hankchan/Workspace/python_script# hexdump -C < test.sms 00000000 54 6f 3a 20 38 36 31 35 38 30 30 30 30 30 30 30 |To: 861580000000| 00000010 30 0a 41 6c 70 68 61 62 65 74 3a 20 55 43 53 32 |0.Alphabet: UCS2| 00000020 0a 0a e4 bd a0 e5 a5 bd ef bc 8c e6 b5 8b e8 af |................| 00000030 95 e7 9f ad e4 bf a1 0a |........| 00000038
hankchan: It is strange that if i send this sms file to myself , i can see the correct chinese characters in the incoming folder.but if i check the sms in my mobile inbox , it just display messy code.can anyone give me some suggesting?
hankchan: hi, i have create a sms file with Alphabet has the value "UCS2",and i add some chinese characters as sms body.I can send it successfully,but when i check it in Mobile ,it is not my except.It looks like i didn't choose the right file format for the sms file .did i miss anythig? thank root@hankchan-server:/home/hankchan/Workspace/python_script# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= root@hankchan-server:/home/hankchan/Workspace/python_script# file test.sms test.sms: UTF-8 Unicode text root@hankchan-server:/home/hankchan/Workspace/python_script# cat test.sms To: 86158XXXXXXXX Alphabet: UCS2 浣.ソ锛.?璇..淇 root@hankchan-server:/home/hankchan/Workspace/python_script# cp test.sms /var/spool/sms/outgoing/ this is my smsd.conf: # Example smsd.conf. Read the manual for a description devices = Modem1 logfile = /var/log/smsd.log loglevel = 7 stats = /var/spool/sms/stats failed= /var/spool/sms/failed sent = /var/spool/sms/sent #use the checkhandler to convert outgoing messages from UTF-8 to ISO #checkhandler = /home/hankchan/Workspace/smstools3/scripts/checkhandler-utf-8 [Modem1] #device = /dev/ttyS0 #device = /dev/ttyACM0 device = /dev/ttyUSB0 incoming = high #pin = 1111s

Page:  1

SMSTools3 Community » Search Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.