CN104809100A - Text coding and decoding method and corresponding coding and decoding system - Google Patents

Text coding and decoding method and corresponding coding and decoding system Download PDF

Info

Publication number
CN104809100A
CN104809100A CN201510155555.8A CN201510155555A CN104809100A CN 104809100 A CN104809100 A CN 104809100A CN 201510155555 A CN201510155555 A CN 201510155555A CN 104809100 A CN104809100 A CN 104809100A
Authority
CN
China
Prior art keywords
mark
transcoding
data
byte
beginning flag
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201510155555.8A
Other languages
Chinese (zh)
Inventor
何小虎
王鹏
李楚平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Step Electric Corp
Original Assignee
Shanghai Step Electric Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Step Electric Corp filed Critical Shanghai Step Electric Corp
Priority to CN201510155555.8A priority Critical patent/CN104809100A/en
Publication of CN104809100A publication Critical patent/CN104809100A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the invention provides a text coding and decoding method and a corresponding coding and decoding system. According to the coding method, the coding and decoding system is provided with a start mark, a finish mark and a code conversion code in advance, wherein the code conversion code is not the same as the start mark and the finish mark; the data bites the same as the start mark, the finish mark and the code conversion mark in a data packaging packet is subjected to code conversion with the code conversion code according to the preset code conversion rules so as to obtain the code conversion result different from the start mark, the finish mark and the code conversion mark; the obtained code conversion result and the code conversion mark are used for replacing the data bits; the start mark and the finish mark are correspondingly added at the head and end of the replaced data packaging packet and sent; correspondingly, the coding and decoding system is used for decoding the data packaging packet by inverse operation. With the adoption of the method and the system, that some information in the data packaging packet are given up as part of protocol can be prevented.

Description

Text code, coding/decoding method and corresponding coding/decoding system
Technical field
The present invention relates to a kind of text encoding and decoding technique, particularly text code, coding/decoding method and corresponding coding/decoding system.
Background technology
People, when utilizing host-host protocol to transmit text message, can ignore the situation that host-host protocol is identical with partial text information possibility.Therefore, when decoding is transmitted the text message of protocol encapsulation, the part of the valid data information in text message as agreement can be decoded, and then cause the data in partial text information to be dropped.So make the text message of decoding place imperfect or unavailable.
In order to solve the problem, full text information is encoded by technician, makes the text message after encoding long, adds the computational burden of data traffic and coding/decoding system.Therefore, need to improve existing text code, decoding technique.
Summary of the invention
The object of the present invention is to provide a kind of text code, coding/decoding method and corresponding coding/decoding system, for solving the problem that text message encoding and decoding of the prior art are too complicated, add data traffic.
For solving the problems of the technologies described above, embodiments of the present invention provide a kind of text code method, comprise: preset beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark; According to the transcoding rule preset, data byte identical with transcoding mark with described beginning flag, end mark in described data packet and described transcoding mark are carried out transcoding process, to obtain the transcoding result being different from described beginning flag, end mark and transcoding mark, and replace described data byte with obtained transcoding result and described transcoding mark; The head and the tail place correspondence of the data packet after replacement increases described beginning flag and end mark, and is sent.
Based on above-mentioned purpose, the present invention also provides a kind of decode text method, comprising: preset beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark byte; Based on described beginning flag and end mark, from obtained packet, extract data packet; Check the described transcoding mark in described data packet, the data of two bytes comprising described transcoding mark are converted to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
Based on above-mentioned purpose, the present invention also provides a kind of text encoding systems, comprises: the first memory module, and for storing default beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark; Coding module, for regular according to the transcoding preset, data byte identical with transcoding mark with described beginning flag, end mark in described data packet and described transcoding mark are carried out transcoding process, to obtain the transcoding result being different from described beginning flag, end mark and transcoding mark, and replace described data byte with obtained transcoding result and described transcoding mark; Package module, the head and the tail place correspondence for the data packet after replacement increases described beginning flag and end mark, and is sent.
Based on above-mentioned purpose, the present invention also provides a kind of decode text system, comprising: the second memory module, and for storing default beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark byte; Decapsulation module, for based on described beginning flag and end mark, extracts data packet from obtained packet; Decoder module, for checking the described transcoding mark in described data packet, convert the data of two bytes comprising described transcoding mark to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
Embodiment of the present invention in terms of existing technologies, by arranging beginning flag and end mark outside data packet, can help decode system identification partial data package, preventing the partial information in data packet be taken as the part of agreement and be dropped.
In addition, described data byte and the transcoding mark preset are carried out logical operation, so that operation result and described transcoding mark are substituted described data byte by the present invention.Can prevent from data packet, comprising the data byte identical with end mark with described beginning flag, and decoded system misoperation destroy data packet.Meanwhile, come by the byte of transcoding in identification data package with transcoding mark, only on the basis of original data packet, increase by 1 byte, not only greatly reduce the difficulty of decoding, more decrease data traffic.
In addition, when comprising the data byte identical with described transcoding mark in data packet, representing described data byte with two transcoding marks, effectively reducing data traffic on the one hand, on the other hand, still reducing decoding difficulty.
Further, verification is carried out to data block and can guarantee that decode system verifies that whether the data block received is complete.Effectively ensure that the correctness of follow-up data process.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of the text code method of the first embodiment of the present invention;
Fig. 2 is the process flow diagram of the decode text method of the second embodiment of the present invention;
Fig. 3 is the text encoding systems structural drawing of the 3rd embodiment of the present invention;
Fig. 4 is the decode text system construction drawing of the 4th embodiment of the present invention.
Embodiment
For making the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, the embodiments of the present invention are explained in detail.But, persons of ordinary skill in the art may appreciate that in each embodiment of the present invention, proposing many ins and outs to make reader understand the application better.But, even without these ins and outs with based on the many variations of following embodiment and amendment, each claim of the application technical scheme required for protection also can be realized.
Embodiment one
As shown in Figure 1, the first embodiment of the present invention relates to a kind of text code method.Described text code method performs primarily of text encoding systems.Wherein, described text encoding systems comprises the software and hardware of electronic equipment.Described electronic equipment comprises any equipment that can carry out numerical value and logical operation according to pre-set programs, and it includes but not limited to: single/multiple server, personal terminal, mobile device, embedded device etc.
Beginning flag, end mark and transcoding mark is preset with in described text encoding systems.Wherein, described beginning flag, end mark and transcoding mark are all set to single byte of data.Described beginning flag, end mark and transcoding mark are different from each other.Preferably, described beginning flag, end mark and transcoding mark are not all full 0 and complete 1 byte.
The data block that will encode is encapsulated in data packet by described text encoding systems.Verify the integrality of described data block in order to ensure corresponding decode system, preferably, also comprise in described data packet: check block.
Corresponding, before described text encoding systems is encoded, described text code method performs step S10.(not giving diagram)
In step slo, all bytes in described data block are done numerical evaluation by described text encoding systems, set described check block according to obtained numerical result.
Particularly, all bytes in described data block are done additive operation by described text encoding systems, obtain a multibyte numerical value.Described text encoding systems can carry out XOR etc. by described multibyte numerical value negate or by described multibyte numerical value and the numerical value of the equal byte preset, and the result obtained is as described check block.
Preferably, the default byte in obtained numerical result splits by described text encoding systems, and using the multiple bytes after fractionation as described check block.
Such as, described text encoding systems extracts last byte value in described multibyte numerical value, again extracted byte value is split into two bytes according to low level and a high position, wherein, a described high position is positioned at a high position for first character joint, described low level is positioned at the low level of second byte, other position full 0s of these two bytes or complete 1 cover.Then described check block is set to described first character joint and second byte.Then described data block and check block are carried out package by described text encoding systems.
It should be noted that, it should be appreciated by those skilled in the art that the acquisition mode of described check block is only citing.But not limitation of the present invention.In prior art or the acquisition mode of the check block occurred from now on if be suitable for the present invention, also should be included within scope of the present invention.
In step s 11, described text encoding systems is according to the transcoding rule preset, data byte identical with transcoding mark with described beginning flag, end mark in described data packet and described transcoding mark are carried out transcoding process, to obtain the transcoding result being different from described beginning flag, end mark and transcoding mark, and replace described data byte with obtained transcoding result and described transcoding mark.
Particularly, described text encoding systems travels through all data bytes in described data packet, when detecting that data byte and described beginning flag, end mark are identical with transcoding mark, in order to avoid corresponding decode system make misunderstanding operation (as, misdeem the start-stop mark of data packet, transcoding mark etc.), need to carry out transcoding to detected data byte.
Described text encoding systems carries out transcoding to detected data byte, and includes but not limited to by the mode that obtained transcoding result and described transcoding mark replace described data byte:
1) data byte identical with end mark with described beginning flag in described data packet and described transcoding mark are carried out logical operation, to obtain the operation result all not identical with end mark with described beginning flag, and replace described data byte with obtained operation result and described transcoding mark.
Such as, the described beginning flag preset is 0x20, and default described transcoding is masked as 0x40, and described text encoding systems detects that the data byte in data block is also 0x20, then described data byte and transcoding mark are carried out XOR and obtain 0x60.0x20 data byte in described data block, according to the byte order of the transcoding mark+operation result preset, is replaced to 0x400x60 by described text encoding systems.
2) identical with described transcoding mark in the described data packet described transcoding mark of the front/rear insertion of data byte, and replace described data byte with obtained continuous two described transcoding marks.
Such as, the described transcoding preset is masked as 0x40, and described text encoding systems detects that the data byte in check block is also 0x40, then before described data byte 0x40, insert described transcoding mark.Namely the data of two bytes of replacing described data byte 0x40 are obtained: 0x400x40.
Then, in step s 12, the head and the tail place correspondence of the data packet of described text compiling system after replacement increases described beginning flag and end mark, and is sent.
Particularly, the head and the tail place of the data packet after replacement in step S1 correspondence is increased described beginning flag and end mark by described text compiling system.Then according to communication protocols such as http, https, be sent to including described beginning flag and end mark and data packet the receiving end including corresponding decoding system.
It should be noted that, it should be appreciated by those skilled in the art that above-mentioned steps S1 and S2 and not necessarily performs according to description order.Can also first perform step S2 and perform step S1 again.
Embodiment two
As shown in Figure 2.Corresponding to the text code method described in embodiment one, the present embodiment also provides a kind of decode text method.Described decode text method performs primarily of decode text system.Wherein, described decode text system comprises the software and hardware of electronic equipment.Described electronic equipment comprises any equipment that can carry out numerical value and logical operation according to pre-set programs, and it includes but not limited to: single/multiple server, personal terminal, mobile device, embedded device etc.
Beginning flag, end mark and the transcoding mark preserved in corresponding described text encoding systems is preset with in described decode text system.Wherein, described beginning flag, end mark and transcoding mark are all set to single byte of data.Described beginning flag, end mark and transcoding mark are different from each other.Preferably, described beginning flag, end mark and transcoding mark are not all full 0 and complete 1 byte.
In the step s 21, described decode text system, based on described beginning flag and end mark, extracts data packet from obtained packet.
Particularly, described decode text system, when receiving a packet, extracts the data packet in described packet according to the beginning flag preset and end mark.Wherein, described data packet comprises data block.Even comprise: for verifying the check block of the integrality of described data block.
In step S22, described transcoding mark in data packet described in described decode text systems inspection, the data of two bytes comprising described transcoding mark are converted to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
Particularly, each byte in data packet described in described decode text systems inspection, when being present in the identical data byte of described transcoding mark, the data of two bytes comprising described transcoding mark are converted to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
At this, the mode that the described data by two bytes comprising described transcoding mark convert a data byte to includes but not limited to:
1) data byte of non-transcoding mark in the data comprising two bytes of described transcoding mark and described transcoding mark are carried out logical operation, to obtain the operation result identical with described beginning flag or end mark, and obtained operation result is replaced the data of described two bytes.
Such as, described decode text systems axiol-ogy goes out data block and comprises: ... 0x1A 0x040x06 ... Deng data byte, wherein, 0x04 is described transcoding mark.According to the array configuration of the transcoding mark+coded data preset, 0x06 data byte after 0x04 data byte is carried out decoding computing, that is: 0x06 and 0x04 is carried out XOR, obtain 0x02 data byte, then the decoded data block that described decode text system obtains comprises: ... 0x1A 0x02 ... Deng data byte.
2) a described transcoding mark in continuous two described transcoding marks in described data packet is removed, and using the described transcoding mark after removal as the raw data in described data packet.
Such as, described decode text systems axiol-ogy goes out data block and comprises: ... 0x1A 0x040x04 ... Deng data byte, wherein, 0x04 is described transcoding mark.According to the array configuration of the transcoding mark+transcoding mark preset, removed by one of them 0x04 data byte, then the decoded data block that described decode text system obtains comprises: ... 0x1A 0x04 ... Deng data byte.
Preferably, if comprise check block in described data packet, then described decode text method also comprises: step S23.(not giving diagram)
In step S23, check block described in described decode text system verification is to determine that whether described data block is complete.
Particularly, described decode text system corresponds to described text encoding systems, all bytes in described data block is done additive operation, obtains a multibyte numerical value.Described text encoding systems can carry out XOR etc. by described multibyte numerical value negate or by described multibyte numerical value and the numerical value of the equal byte preset, obtained result and described check block are compared, if identical, then determines that described data block is complete, otherwise, then imperfect.
Preferably, all bytes in described data block are done numerical evaluation by described decode text system, and the default byte in obtained numerical result are split; Again the multiple byte data after fractionation is carried out verification with described check block to mate.
Such as, described decode text system extracts last byte value in described multibyte numerical value, again extracted byte value is split into two bytes according to low level and a high position, wherein, a described high position is positioned at a high position for first character joint, described low level is positioned at the low level of second byte, other position full 0s of these two bytes or complete 1 cover.Compare obtained check block more whether identical with the check block in received described data packet, if identical, then determine that described data block is complete, otherwise, then imperfect.
Embodiment three
As shown in Figure 3, the first embodiment of the present invention relates to a kind of text encoding systems.Wherein, described text encoding systems 1 comprises the software and hardware of electronic equipment.Described electronic equipment comprises any equipment that can carry out numerical value and logical operation according to pre-set programs, and it includes but not limited to: single/multiple server, personal terminal, mobile device, embedded device etc.
Described text encoding systems 1 comprises: the first memory module 11, coding module 12 and package module 13.
Beginning flag, end mark and transcoding mark is stored in described first memory module 11.Wherein, described beginning flag, end mark and transcoding mark are all set to single byte of data.Described beginning flag, end mark and transcoding mark are different from each other.Preferably, described beginning flag, end mark and transcoding mark are not all full 0 and complete 1 byte.
The data block that will encode is encapsulated in data packet by described text encoding systems 1.Verify the integrality of described data block in order to ensure corresponding decode system, preferably, also comprise in described data packet: check block.
Corresponding, described text encoding systems 1 also comprises correction verification module (not giving diagram).
Described correction verification module was used for before described text encoding systems 1 is encoded, and all bytes in described data block is done numerical evaluation, sets described check block according to obtained numerical result.
Particularly, all bytes in described data block are done additive operation by described correction verification module, obtain a multibyte numerical value.Described correction verification module can carry out XOR etc. by described multibyte numerical value negate or by described multibyte numerical value and the numerical value of the equal byte preset, and the result obtained is as described check block.
Preferably, the default byte in obtained numerical result splits by described correction verification module, and using the multiple bytes after fractionation as described check block.
Such as, described correction verification module extracts last byte value in described multibyte numerical value, again extracted byte value is split into two bytes according to low level and a high position, wherein, a described high position is positioned at a high position for first character joint, described low level is positioned at the low level of second byte, other position full 0s of these two bytes or complete 1 cover.Then described check block is set to described first character joint and second byte.Then described data block and check block are carried out package by described correction verification module.
It should be noted that, it should be appreciated by those skilled in the art that the acquisition mode of described check block is only citing.But not limitation of the present invention.In prior art or the acquisition mode of the check block occurred from now on if be suitable for the present invention, also should be included within scope of the present invention.
Described coding module 12 is for regular according to the transcoding preset, data byte identical with transcoding mark with described beginning flag, end mark in described data packet and described transcoding mark are carried out transcoding process, to obtain the transcoding result being different from described beginning flag, end mark and transcoding mark, and replace described data byte with obtained transcoding result and described transcoding mark.
Particularly, described coding module 12 travels through all data bytes in described data packet, when detecting that data byte and described beginning flag, end mark are identical with transcoding mark, in order to avoid corresponding decode system make misunderstanding operation (as, misdeem the start-stop mark of data packet, transcoding mark etc.), need to carry out transcoding to detected data byte.
Described coding module 12 carries out transcoding to detected data byte, and includes but not limited to by the mode that obtained transcoding result and described transcoding mark replace described data byte:
1) data byte identical with end mark with described beginning flag in described data packet and described transcoding mark are carried out logical operation, to obtain the operation result all not identical with end mark with described beginning flag, and replace described data byte with obtained operation result and described transcoding mark.
Such as, the described beginning flag preset is 0x20, and default described transcoding is masked as 0x40, and described coding module 12 detects that the data byte in data block is also 0x20, then described data byte and transcoding mark are carried out XOR and obtain 0x60.0x20 data byte in described data block, according to the byte order of the transcoding mark+operation result preset, is replaced to 0x400x60 by described coding module 12.
2) identical with described transcoding mark in the described data packet described transcoding mark of the front/rear insertion of data byte, and replace described data byte with obtained continuous two described transcoding marks.
Such as, the described transcoding preset is masked as 0x40, and described coding module 12 detects that the data byte in check block is also 0x40, then before described data byte 0x40, insert described transcoding mark.Namely the data of two bytes of replacing described data byte 0x40 are obtained: 0x400x40.
Then, described package module 13 increases described beginning flag and end mark for the head and the tail place correspondence of the data packet after replacement, and is sent.
Particularly, the head and the tail place of the data packet after replacement in described coding module 12 correspondence is increased described beginning flag and end mark by described package module 13.Then according to communication protocols such as http, https, be sent to including described beginning flag and end mark and data packet the receiving end including corresponding decoding system.
It should be noted that, it should be appreciated by those skilled in the art that above-mentioned coding module 12 and package module 13 and not necessarily performs according to description order.First can also perform package module 13 and perform coding module 12 again.
Embodiment four
As shown in Figure 4, corresponding to the text encoding systems described in embodiment three, the present embodiment also provides a kind of decode text system 2.Wherein, described decode text system 2 comprises the software and hardware of electronic equipment.Described electronic equipment comprises any equipment that can carry out numerical value and logical operation according to pre-set programs, and it includes but not limited to: single/multiple server, personal terminal, mobile device, embedded device etc.
Described decode text system 2 comprises: the second memory module 21, decapsulation module 22 and decoder module 23.
Beginning flag, end mark and the transcoding mark preserved in corresponding described text encoding systems is stored in described second memory module 21.Wherein, described beginning flag, end mark and transcoding mark are all set to single byte of data.Described beginning flag, end mark and transcoding mark are different from each other.Preferably, described beginning flag, end mark and transcoding mark are not all full 0 and complete 1 byte.
Described decapsulation module 22, for based on described beginning flag and end mark, extracts data packet from obtained packet.
Particularly, described decapsulation module 22, when receiving a packet, extracts the data packet in described packet according to the beginning flag preset and end mark.Wherein, described data packet comprises data block.Even comprise: for verifying the check block of the integrality of described data block.
Described decoder module 23 is for checking the described transcoding mark in described data packet, the data of two bytes comprising described transcoding mark are converted to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
Particularly, described decoder module 23 checks each byte in described data packet, when being present in the identical data byte of described transcoding mark, the data of two bytes comprising described transcoding mark are converted to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
At this, the mode that the described data by two bytes comprising described transcoding mark convert a data byte to includes but not limited to:
1) data byte of non-transcoding mark in the data comprising two bytes of described transcoding mark and described transcoding mark are carried out logical operation, to obtain the operation result identical with described beginning flag or end mark, and obtained operation result is replaced the data of described two bytes.
Such as, described decoder module 23 detects that data block comprises: ... 0x1A 0x040x06 ... Deng data byte, wherein, 0x04 is described transcoding mark.According to the array configuration of the transcoding mark+coded data preset, 0x06 data byte after 0x04 data byte is carried out decoding computing, that is: 0x06 and 0x04 is carried out XOR, obtain 0x02 data byte, then the decoded data block that described decoder module 23 obtains comprises: ... 0x1A 0x02 ... Deng data byte.
2) a described transcoding mark in continuous two described transcoding marks in described data packet is removed, and using the described transcoding mark after removal as the raw data in described data packet.
Such as, described decode text system 2 detects that data block comprises: ... 0x1A 0x040x04 ... Deng data byte, wherein, 0x04 is described transcoding mark.According to the array configuration of the transcoding mark+transcoding mark preset, removed by one of them 0x04 data byte, then the decoded data block that described decoder module 23 obtains comprises: ... 0x1A 0x04 ... Deng data byte.
Preferably, if comprise check block in described data packet, then described decode text system 2 also comprises: verification authentication module (not giving diagram).
Described verification authentication module is for verifying that described check block is to determine that whether described data block is complete.
Particularly, described verification authentication module corresponds to described text encoding systems, all bytes in described data block is done additive operation, obtains a multibyte numerical value.Described text encoding systems can carry out XOR etc. by described multibyte numerical value negate or by described multibyte numerical value and the numerical value of the equal byte preset, obtained result and described check block are compared, if identical, then determines that described data block is complete, otherwise, then imperfect.
Preferably, all bytes in described data block are done numerical evaluation by described verification authentication module, and the default byte in obtained numerical result are split; Again the multiple byte data after fractionation is carried out verification with described check block to mate.
Such as, described verification authentication module extracts last byte value in described multibyte numerical value, again extracted byte value is split into two bytes according to low level and a high position, wherein, a described high position is positioned at a high position for first character joint, described low level is positioned at the low level of second byte, other position full 0s of these two bytes or complete 1 cover.Compare obtained check block more whether identical with the check block in received described data packet, if identical, then determine that described data block is complete, otherwise, then imperfect.
It should be noted that, above-mentioned text encoding systems and decode text system can be arranged in coding/decoding system.Wherein, described coding/decoding system comprises installation software in the electronic device and hardware.Described electronic equipment includes but not limited to: single/multiple server, personal terminal, mobile device, embedded system etc.
It is worth mentioning that, each module involved in present embodiment and unit are logic module and logical block, and in actual applications, a logical block can be a physical location, also can be a part for a physical location, can also realize with the combination of multiple physical location.In addition, in order to outstanding innovative part of the present invention, the unit not too close with solving technical matters relation proposed by the invention is not introduced in present embodiment, but this does not show the unit that there is not other in present embodiment.
Persons of ordinary skill in the art may appreciate that the respective embodiments described above realize specific embodiments of the invention, and in actual applications, various change can be done to it in the form and details, and without departing from the spirit and scope of the present invention.

Claims (10)

1. a text code method, is characterized in that, comprises:
Preset beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark;
According to the transcoding rule preset, data byte identical with transcoding mark with described beginning flag, end mark in described data packet and described transcoding mark are carried out transcoding process, to obtain the transcoding result being different from described beginning flag, end mark and transcoding mark, and replace described data byte with obtained transcoding result and described transcoding mark;
The head and the tail place correspondence of the data packet after replacement increases described beginning flag and end mark, and is sent.
2. text code method according to claim 1, is characterized in that, described data packet comprises: data block; Also comprise in described data packet: check block; Corresponding described text code method also comprises: all bytes in described data block are done numerical evaluation, sets described check block according to obtained numerical result.
3. text code method according to claim 2, it is characterized in that, the described mode setting described check block according to obtained numerical result comprises: the default byte in obtained numerical result split, and using the multiple bytes after splitting as described check block.
4. the text code method according to claim 1,2 or 3, is characterized in that, described default transcoding rule comprises:
Data byte identical with end mark with described beginning flag in described data packet and described transcoding mark are carried out logical operation, to obtain the operation result all not identical with end mark with described beginning flag;
And/or, the described transcoding mark of the front/rear insertion of data byte identical with described transcoding mark in described data packet.
5. a decode text method, is characterized in that, comprising:
Preset beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark byte;
Based on described beginning flag and end mark, from obtained packet, extract data packet;
Check the described transcoding mark in described data packet, the data of two bytes comprising described transcoding mark are converted to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
6. decode text method according to claim 5, is characterized in that, described data packet comprises: data block; Also comprise in described data packet: check block; Corresponding described decode text method also comprises: verify that described check block is to determine that whether described data block is complete.
7. decode text method according to claim 6, is characterized in that, the mode of the described check block of described checking comprises:
All bytes in described data block are done numerical evaluation, and the default byte in obtained numerical result is split;
Multiple byte data after fractionation is carried out verification with described check block mate.
8. the decode text method according to claim 5,6 or 7, is characterized in that, described default transcoding rule comprises:
The data byte of non-transcoding mark in the data comprising two bytes of described transcoding mark and described transcoding mark are carried out logical operation, to obtain the operation result identical with described beginning flag or end mark;
And/or, remove a described transcoding mark in continuous two described transcoding marks in described data packet.
9. a text encoding systems, is characterized in that, comprises:
First memory module, for storing default beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark;
Coding module, for regular according to the transcoding preset, data byte identical with transcoding mark with described beginning flag, end mark in described data packet and described transcoding mark are carried out transcoding process, to obtain the transcoding result being different from described beginning flag, end mark and transcoding mark, and replace described data byte with obtained transcoding result and described transcoding mark;
Package module, the head and the tail place correspondence for the data packet after replacement increases described beginning flag and end mark, and is sent.
10. a decode text system, is characterized in that, comprising:
Second memory module, for storing default beginning flag, end mark and transcoding mark, wherein, described transcoding mark is not equal to described beginning flag and end mark byte;
Decapsulation module, for based on described beginning flag and end mark, extracts data packet from obtained packet;
Decoder module, for checking the described transcoding mark in described data packet, convert the data of two bytes comprising described transcoding mark to a data byte according to the transcoding rule preset, and replace the data of described two bytes with described data byte, to obtain original data packet.
CN201510155555.8A 2015-04-02 2015-04-02 Text coding and decoding method and corresponding coding and decoding system Pending CN104809100A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510155555.8A CN104809100A (en) 2015-04-02 2015-04-02 Text coding and decoding method and corresponding coding and decoding system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510155555.8A CN104809100A (en) 2015-04-02 2015-04-02 Text coding and decoding method and corresponding coding and decoding system

Publications (1)

Publication Number Publication Date
CN104809100A true CN104809100A (en) 2015-07-29

Family

ID=53693931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510155555.8A Pending CN104809100A (en) 2015-04-02 2015-04-02 Text coding and decoding method and corresponding coding and decoding system

Country Status (1)

Country Link
CN (1) CN104809100A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486885A (en) * 2020-12-07 2021-03-12 珠海优特智厨科技有限公司 Data frame generation method, storage medium and computer equipment
CN113691546A (en) * 2021-08-26 2021-11-23 广东电网有限责任公司广州供电局 Integrity verification method, system, equipment and medium for text file

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1238615A (en) * 1998-02-25 1999-12-15 松下电器产业株式会社 Data communication method, communication frame generating method, and medium on which program for carrying out methods are recorded
US20010012288A1 (en) * 1999-07-14 2001-08-09 Shaohua Yu Data transmission apparatus and method for transmitting data between physical layer side device and network layer device
CN1310905A (en) * 1999-07-14 2001-08-29 信息产业部武汉邮电科学研究院 Data transmission apparatus and method for transmitting data between physical layer side device and network layer device
CN1377162A (en) * 2001-03-27 2002-10-30 信息产业部武汉邮电科学研究院 Data transmission device and method between physical layer and network layer
WO2012091371A1 (en) * 2010-12-26 2012-07-05 Lg Electronics Inc. Method for transmitting broadcast service, method for receiving the broadcasting service, and apparatus for receiving the broadcasting service
CN103095835A (en) * 2013-01-17 2013-05-08 成都理想科技开发有限公司 Realization method for reasonable construction and correct parse of communication data package based on alarm system
CN103825675A (en) * 2014-01-28 2014-05-28 华南理工大学 Coding method and apparatus in secondary ultrasonic communication
CN103841143A (en) * 2012-11-23 2014-06-04 华为技术有限公司 File sending method, receiving method, system and device
EP2753079A1 (en) * 2011-11-01 2014-07-09 ZTE Corporation Fragmentation-layer parameter set coding and decoding method and device
CN103914419A (en) * 2012-12-29 2014-07-09 北京谊安医疗系统股份有限公司 Communication method and system among board-level MCUs

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1238615A (en) * 1998-02-25 1999-12-15 松下电器产业株式会社 Data communication method, communication frame generating method, and medium on which program for carrying out methods are recorded
US20010012288A1 (en) * 1999-07-14 2001-08-09 Shaohua Yu Data transmission apparatus and method for transmitting data between physical layer side device and network layer device
CN1310905A (en) * 1999-07-14 2001-08-29 信息产业部武汉邮电科学研究院 Data transmission apparatus and method for transmitting data between physical layer side device and network layer device
CN1377162A (en) * 2001-03-27 2002-10-30 信息产业部武汉邮电科学研究院 Data transmission device and method between physical layer and network layer
WO2012091371A1 (en) * 2010-12-26 2012-07-05 Lg Electronics Inc. Method for transmitting broadcast service, method for receiving the broadcasting service, and apparatus for receiving the broadcasting service
EP2753079A1 (en) * 2011-11-01 2014-07-09 ZTE Corporation Fragmentation-layer parameter set coding and decoding method and device
CN103841143A (en) * 2012-11-23 2014-06-04 华为技术有限公司 File sending method, receiving method, system and device
CN103914419A (en) * 2012-12-29 2014-07-09 北京谊安医疗系统股份有限公司 Communication method and system among board-level MCUs
CN103095835A (en) * 2013-01-17 2013-05-08 成都理想科技开发有限公司 Realization method for reasonable construction and correct parse of communication data package based on alarm system
CN103825675A (en) * 2014-01-28 2014-05-28 华南理工大学 Coding method and apparatus in secondary ultrasonic communication

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
陈荔等: ""基于串口自定义协议传输文件的设计"", 《计算机技术与发展》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112486885A (en) * 2020-12-07 2021-03-12 珠海优特智厨科技有限公司 Data frame generation method, storage medium and computer equipment
CN113691546A (en) * 2021-08-26 2021-11-23 广东电网有限责任公司广州供电局 Integrity verification method, system, equipment and medium for text file

Similar Documents

Publication Publication Date Title
CN104703176B (en) Configuration method of wireless network, intelligent terminal and wireless network equipment
CN110324115B (en) Data transmission method and device, storage medium and terminal equipment
CN111262876B (en) Data processing method, device and equipment based on block chain and storage medium
CN108777606B (en) Decoding method, apparatus and readable storage medium
CN101702639B (en) Check value calculation method and device of cyclic redundancy check
CN106453160A (en) Beidou data transmission method and system
CN111147462A (en) FPGA-based step protocol analysis method, system, terminal and storage medium
CN103036641B (en) Method for interchanging data, system and unserializing method
CN105281843A (en) Two-dimensional code transmission and reception methods and transmission and reception devices
CN113242109A (en) Method, device and equipment for checking message data
CN104809100A (en) Text coding and decoding method and corresponding coding and decoding system
CN116208420B (en) Monitoring information safety transmission method, system, equipment and storage medium
CN113517982B (en) Password generation method, password execution method and terminal
CN105187219A (en) Method for preventing tampering of identity information in real name authentication
CN102325025A (en) Data processing method and system for verifying provision source authenticity
CN104601284A (en) Method, device and system for transmitting data information
CN104360988A (en) Method and device for identifying coding mode of Chinese characters
CN103152464A (en) Equipment, method and system of obtaining fixed phone calling information through wireless way
CN113162628B (en) Data encoding method, data decoding method, terminal and storage medium
CN111147461B (en) Data transmission method, device, server and user terminal
CN108551366B (en) Visible light communication method based on LED and mobile phone camera
CN106102025A (en) A kind of Encrypted short message coding method based on Android
CN110691212A (en) Method and system for coding and decoding data
CN112486885A (en) Data frame generation method, storage medium and computer equipment
CN112235607A (en) Data security protection method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150729

RJ01 Rejection of invention patent application after publication