Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
Method and the device of a kind of short message coding that the embodiment of the present invention provides, core is on ESME, short message to be sent in SMSC process based on SMPP agreement, according to point block message of short message, in coded system under SMPP agreement, determine the target code mode of this short message, thereby after this short message being encoded according to target code mode, send to short message service center, realized in Unicode coding range user and input the selection of the optimum code scheme of short message in SMPP agreement.
As shown in Figure 1, the embodiment of the present invention proposes a kind of coding method of short message with the angle of ESME, and in the embodiment of the present invention, ESME is Web server, can be achieved through the following technical solutions:
Step 101:Web server obtains the short message from web browser;
Step 102:Web server obtains corresponding point block message according to described short message;
Step 103:Web server in the coded system of SMPP Short Message Peer to Peer, is determined the target code mode of described short message according to described point of block message;
Step 104:Web server is encoded to described short message according to described target code mode.
For above-mentioned steps, in one embodiment of the invention, step 101 can be achieved through the following technical solutions:
(1) user after the coding that Web server reception web browser sends inputs short message;
Web browser is user's input page that gives information, and user inputs the short message that will send in message input page, and submits to web browser.Web server is not lost in order to ensure the input message that user submits to, conventionally adopt the coded system of specifying, in the time that user submits short message to web browser to, the page coded system that web browser is specified according to Web server will send to Web server after short message coding.
In the embodiment of the present invention, user can arrange the native language information Accept-Language of web browser according to self custom or native language type, to determine the language form of the web browser that will use.Wherein, Accept-Language is set in web browser, can open by " language " option of " Internet attribute ", in language preference, can add or delete native language information, and can adjust priority, can freely select suitable native language information according to native language type or self custom by this selection user.
(2) Web server is decoded to described short message, obtains described short message character string.
Web server receives after the short message after web browser coding, adopts the coding/decoding method corresponding with prescribed coding mode to decode to short message, obtains the character string of content of short message.
In one embodiment of the invention, step 102 specifically can be achieved through the following technical solutions:
In the content of short message character string that Web server obtains according to decoding, CodePoint (Unicode encoded radio) value of each character self is determined point block message that each character is corresponding in Unicode database.Due to UCD (Unicode Character Database Unicode, character database) code bit of Unicode is defined as to some continuous Block piecemeals, and the purposes of having described each Block is language form, as: China, Japan and Korea S. unify ideograph, basic Latin alphabet etc., therefore, each Unicode character has the Block attribute under in the of.So the each character in content of short message character string all by according to languages type categorization in different piecemeals.This point of block message is the code bit of character correspondence in Unicode database.
In one embodiment of the invention, step 103 specifically can be achieved through the following technical solutions:
The described point block message corresponding according to each character in described short message character string, the target code mode of definite described short message in the coded system of SMPP agreement.
Specifically, in the coded system that SMPP agreement specifies, in short message there is many-one or man-to-man relation in point block message and the coded system of each character in Unicode coded data storehouse, in the time that a point block message for each character in user's short message all drops in SMPP agreement in one and same coding mode, can determine the target code mode of this short message, directly according to corresponding target code mode, short message be encoded.
In the time can not determine SMPP coded system according to a point block message for short message, point block message and native language information that can be corresponding according to each character in described short message character string, determine the target code mode of described short message in the coded system of SMPP agreement.
Specifically, described native language information is the native language information that arranges on web browser or the native language information of web page server place main frame.In the time that user has set the native language information Accept-Language of web browser, web browser is in inputting short message to Web server transmission user, also can send the native language information that user arranges, Web server also can obtain by the mode of active obtaining the native language information of web browser, in the time that user does not arrange the native language information of web browser, the native language information that Web server can arrange place main frame is as the native language information of web browser.
For example: when in the short message that user submits to by web browser, when not only having comprised English but also comprised Chinese character, point block message of determining in Unicode coded data storehouse by each character in short message, English in this message can match with the coded system of the basic Latin alphabet in SMPP agreement, Chinese character in this message can with SMPP agreement under China, Japan and Korea S.'s coded system of unifying ideograph match, but China, Japan and Korea S. unify not provide in ideograph corresponding coded system, due in the language of China, Japan and Korea S. all likely with Chinese character, so can not directly determine the target code mode of this short message by described point of block message.For this situation, the embodiment of the present invention can further be identified the language form under this Chinese character according to the native language information of web browser, when the serviced end of native language information Accept-Language is identified as: when the native language information of zh_CN, ja_JP, ko_KR and so on, just can accurately draw the corresponding target code mode in SMPP of the character of above-mentioned existence half-heartedness property according to this information: Chinese corresponding UCS2, the corresponding JIS of Japanese, the corresponding KS C 5601 in Korean.
In one embodiment of the invention, described in the embodiment of the present invention, method can also comprise: send the short message after encoding according to described target code mode to short message service center.
For the coding method of a kind of short message of the clearer explanation embodiment of the present invention, to describe below in conjunction with example, the content of inputting short message taking user is in this example elaborated to the coding flow process of whole short message as " I want to learn Japan ".
100: the short message input page input short message that user provides by web browser:
In order to ensure not lose when short message that user inputs by short message input page is submitted to web browser, in example of the present invention, Web server is that to specify the coded system of short message be UTF-8 coding to web browser; In example of the present invention, user can also set by " language " option of " Internet attribute " the native language information of web browser according to native language type or personal habits, in this example, user sets " Japanese " as the preference in native language information; User is at web browser message input page input short message " I want to learn Japan ", and web browser adopts UTF-8 to encode to this short message;
200:Web server obtains the short message of user's input by web browser;
" I want to learn Japan " is encoded to the content in being expert at as UTF-8 in Fig. 2 by web browser; According to the coding/decoding method corresponding with prescribed coding mode UTF-8, obtain Unicode character for " Iwant to learn Japan ", then the Code Point value of definite each character is obtained corresponding point block message in Unicode coded data storehouse, short message character string has been divided into basic Latin character region and Chinese character region according to a point block message, wherein, a point block message for short message Chinese and English part is 0000-007F, belong to the basic Latin alphabet, a point block message for Chinese character part is 4E00-9FFF, belongs to China, Japan and Korea S. and unifies ideograph; As shown in Figure 3, in short message, character corresponding to " day " of Chinese character part is the 0x0065e0 shown in Fig. 3, point block message of this character in Unicode coded data storehouse is 4E00-9FFF, belong to the language form that China, Japan and Korea S. unify ideograph, in this manner, a point block message for other Chinese character of example short message of the present invention is 4E00-9FFF.
300:Web server is determined target code mode in SMPP agreement;
Be 0000-007F according to point block message of " the I want to learn " of above-mentioned acquisition, belong to the language form of basic Latin character;
Point block message of " Japan " is 4E00-9FFF, belongs to China, Japan and Korea S. and unifies ideograph region; In coded system under following table SMPP agreement, mate;
Piecemeal information code bit scope |
Language form |
Coded system in SMPP agreement |
0000~007F |
The basic Latin alphabet |
IA5/ASC II |
0080~00FF |
The Latin alphabet supplements-1 |
Latin 1 |
0400~04FF |
Cyrillic literary composition |
Cyrillic |
0590~05FF |
Hebrew |
Latin/Hebrew |
1100~11FF |
Korean |
KS C 5601 |
2E80~2EFF |
China, Japan and Korea S.'s radicals supplement |
- |
3000~303F |
China, Japan and Korea S.'s symbol and punctuate |
- |
3040~309F |
Hiragana |
JIS |
30A0~30FF |
Katakana |
JIS |
3130~318F |
The compatible letter of Korean |
KS C 5601 |
3190~319F |
The Chinese character annotations and comments of Japanese |
- |
31A0~31BF |
Phonetic symbol expands |
- |
31C0~31EF |
China, Japan and Korea S.'s stroke |
- |
31F0~31FF |
Katakana phonetic symbol expands |
Extended Kanji JIS |
3200~32FF |
Parenthesized China, Japan and Korea S. letter and month |
- |
3300~33FF |
China, Japan and Korea S.'s compatibility character |
- |
3400~4DBF |
China, Japan and Korea S. unify ideograph and expand A |
- |
4DC0~4DFF |
The book of Changes 64 relationship resembles |
UCS2 |
4E00~9FFF |
China, Japan and Korea S. unify ideograph |
- |
... |
... |
|
From above-mentioned list, after overmatching, can obtain short message and in SMPP agreement the corresponding relation between coded system, as shown in the table:
Character |
Language form |
Coded system in SMPP agreement |
I want to learn |
The basic Latin alphabet |
IA5/ASCII |
This Language of |
China, Japan and Korea S. unify ideograph |
- |
Because China, Japan and Korea S. unify there is no corresponding coded system in ideograph, the embodiment of the present invention, in order to optimize the encoding scheme of above-mentioned short message, adopts the native language information of web browser to carry out aid identification; The native language information that Accept-Language the HTTP Header message that Web server can send from web browser obtains is ja_JP; Web server determines that in conjunction with " ja " in native language information in short message, " Japan " character can adopt JIS (Japanese IndustrialStandards, Japanese Industrial Standards) coded system, and the simultaneously compatible ASCII coding of JIS, in JIS coding, still can encode according to ASCII coded system to " I want to learn ", the JIS coded system that the optimized encoding scheme that obtains by the way this short message is SMPP; It should be noted that, in the time that user does not arrange the native language information of web browser, the native language information of Web server using the native language information on the main frame of place as web browser;
400:Web server adopts the target code mode JIS in SMPP agreement determining to encode to short message;
500:Web server, based on SMPP agreement, sends according to the short message after JIS coded system coding to short message service center.
In sum, if while adopting the technical scheme of prior art to carry out SMPP coding to " the I want to learn Japan " of user's input in example of the present invention, this short message can be used after general UCS2 coded system is encoded and send based on SMPP agreement, can not adopt forced coding mode byte still less to express identical information.
In example of the present invention, can further identify by the native language information of web browser the Chinese character part in short message, thereby determine the forced coding mode under SMPP agreement, realize and used byte still less to express identical information.
As shown in Figure 4, based on the embodiment of the method shown in above-mentioned Fig. 1, the embodiment of the present invention proposes a kind of code device of short message, can be achieved through the following technical solutions:
Acquisition of information module 41, for obtaining the short message from web browser, and obtains corresponding point block message according to described short message;
Coding processing module 42, for the coded system at SMPP Short Message Peer to Peer according to described point of block message, determines the target code mode of described short message, and according to described target code mode, described short message is encoded.
Shown in Fig. 5, in one embodiment of the invention, described acquisition of information module 41 specifically can comprise:
Message sink unit 411, for receive web browser send coding after user input short message;
Source codec unit 412, for described short message is decoded, obtains described short message character string;
Piecemeal information acquisition unit 413, for obtaining point block message that the each character of described short message character string is corresponding according to described short message character string;
Described coding processing module 42 specifically can comprise:
Coded system determining unit 421 for the described point block message corresponding according to the each character of described short message character string, is determined the target code mode of described short message in the coded system of SMPP agreement;
Target code performance element 422, for encoding to described short message character string according to described target code mode.
In one embodiment of the invention, in the time can not can not determine target code mode in the coded system of SMPP agreement according to a point block message for short message, described coding processing module 42 specifically can comprise:
Coded system determining unit 421 for according to point block message and the native language information of described short message, is determined the target code mode of described short message in the coded system of SMPP agreement; Described native language information is the native language information that arranges on web browser or the native language information of web page server place main frame.
Target code performance element 422, for encoding to described short message according to described target code mode.
In one embodiment of the invention, described device can also comprise:
Message transmission module 43, for sending the short message after encoding according to described target code mode to short message service center.
It should be noted that, device is that embodiment of the method based on as shown in Figure 1 obtains described in the embodiment of the present invention, the embodiment that the concrete technical scheme wherein relating to can be shown in Figure 1, and therefore not to repeat here.
As shown in Figure 6, based on the embodiment of the present invention shown in above-mentioned Fig. 1 and Fig. 4, also provide a kind of coded system of short message, can be achieved through the following technical solutions:
Short message code device 61, for obtaining the short message from web browser, and obtains corresponding point block message according to described short message; In the coded system of SMPP Short Message Peer to Peer, determine the target code mode of described short message according to described point of block message, and according to described target code mode, described short message is encoded;
Short message service center 62, for receiving the short message after encoding according to described target code mode that described short message code device 61 sends.
In one embodiment of the invention, when short message code device according to point block message of short message in the coded system of SMPP agreement, while can not determine the target code mode of this short message, described short message code device also for:
According to point block message and the native language information of described short message, in the coded system of SMPP agreement, determine the target code mode of described short message; Described native language information is the native language information that arranges on web browser or the native language information of web page server place main frame.
Coding method based on a kind of short message of the invention described above embodiment, Apparatus and system, by utilizing point block message of this short message in Unicode character database, can obtain the target code mode in SMPP agreement, encode this short message is adopted to this target code mode, thereby on ESME, short message is sent in SMSC process based on SMPP agreement, realize the code optimization of short message.
One of ordinary skill in the art will appreciate that all or part of flow process realizing in above-described embodiment method, can carry out the hardware that instruction is relevant by computer program to complete, described program can be stored in a computer read/write memory medium, this program, in the time carrying out, can comprise as the flow process of the embodiment of above-mentioned each side method.Wherein, described storage medium can be magnetic disc, CD, read-only store-memory body (Read-Only Memory, ROM) or random store-memory body (Random Access Memory, RAM) etc.
The above; only for preferably embodiment of the present invention, but protection scope of the present invention is not limited to this, is anyly familiar with in technical scope that those skilled in the art disclose in the present invention; the variation that can expect easily or replacement, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.