CN102314413A - Electronic-book skipping and positioning method for mobile terminal - Google Patents

Electronic-book skipping and positioning method for mobile terminal Download PDF

Info

Publication number
CN102314413A
CN102314413A CN2011100432533A CN201110043253A CN102314413A CN 102314413 A CN102314413 A CN 102314413A CN 2011100432533 A CN2011100432533 A CN 2011100432533A CN 201110043253 A CN201110043253 A CN 201110043253A CN 102314413 A CN102314413 A CN 102314413A
Authority
CN
China
Prior art keywords
read
byte
initial value
book
location
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
CN2011100432533A
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 Wingtech Electronic Technology Co Ltd
Original Assignee
Shanghai Wingtech Electronic Technology Co Ltd
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 Wingtech Electronic Technology Co Ltd filed Critical Shanghai Wingtech Electronic Technology Co Ltd
Priority to CN2011100432533A priority Critical patent/CN102314413A/en
Publication of CN102314413A publication Critical patent/CN102314413A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention discloses an electronic-book skipping and positioning method for a mobile terminal. The method comprises the steps of: firstly, calculating a differential value between the number of characters corresponding to the current position of a read electronic-book and a positioning initial value, judging the parity of the differential value, and then regulating and positioning the positioning initial value according to a preset rule. According to the invention, a GB2312 coded electronic-book can be accurately positioned, the dislocated messy codes can be prevented, and the positioning efficiency is increased.

Description

A kind of e-book redirect localization method of portable terminal
Technical field
The present invention relates to the electronic book in mobile terminal field, particularly a kind of e-book redirect localization method of portable terminal.
Background technology
The e-book of portable terminal adopts following dual mode to encode usually: Unicode sign indicating number and GB2312 sign indicating number.For the e-book of Unicode coding, all characters all are to adopt double-byte encodings, as long as guarantee that the difference of location initial value and electronic book documentary initial value is an even number, the situation of redirect dislocation just can not occur during e-book redirect location.But for the e-book of GB2312 coding, its characteristics are, are to adopt the byte coding for ascii character, are to adopt double-byte encodings for Chinese character.Situation about therefore usually occurring is when obtaining locating initial value, can not guarantee that this position is second byte of start byte or the Chinese character of Chinese character or ASCII.Classic method reads character from the file reference position usually one by one, near the initial value of location, judges whether misplace again.This method accuracy is high, but when redirect place with file reference position interval during than multibyte, the redirect speed of e-book can reduce greatly.
Application number is 200610025966; Name is called the patent of " at the method and apparatus that shows e-book on the mobile phone " and has announced a kind of method that on mobile phone, shows e-book; Characteristics are only to read and show at every turn the data of regular length, bookmark information are recorded in the end of file.But its difference that does not relate to the pairing number of characters of e-book current location that reads through calculating and said location initial value positions the technology of redirect.
Summary of the invention
The e-book redirect localization method that the purpose of this invention is to provide a kind of portable terminal is realized the quick redirect of electronic book in mobile terminal.
The present invention provides a kind of e-book redirect localization method of portable terminal, and it is applicable to GB2312 coded electronic book, may further comprise the steps:
1.1, obtain the location initial value of said e-book;
1.2, take off a byte and judge whether to read said electronic book documentary end or read ascii character according to sequential read, if then change next step, then continue if not to read;
1.3, calculate the pairing number of characters of current location read and the difference of said location initial value;
1.4, judge whether said difference is even number, then adjust said location initial value and position if not, if end operation then according to pre-defined rule.
Location initial value in the described step 1.1 obtains by following mode and confirms: during assigned address, said location initial value is the ratio that start byte to be read accounts for this e-book total byte to said e-book in proportion; Said e-book is when the number of pages assigned address, and said location initial value be an appointment number of pages to be read under the certain situation of every page of byte-sized; Said e-book is during by direct specified bytes assigned address, and said location initial value is for specifying the byte of position to be read.
Described step 1.2 comprises following substep:
3.1, read next byte;
3.2, judge whether to read the end of said electronic book documentary, if then change said step 1.3, then change step 3.3 if not;
3.3, judge whether this byte is ascii character, if then change said step 1.3, then continue if not down to read.
Said step 3.2 judges whether to read the end of said electronic book documentary according to following method: current byte position deducts the electronic book documentary initial position and equals electronic book documentary when size, then is judged as the end that reads said electronic book documentary.
Said step 3.3 judges according to following method whether said byte is ascii character: this byte scope then is judged as and reads ascii character during more than or equal to 0x00 and smaller or equal to 0x7f.
Said step 1.2 adopts round-robin algorithm to take off a byte according to sequential read, until reading said electronic book documentary end or reading said ascii character.
In the said step 1.4: if said difference is an even number, then said location initial value does not adjust and end operation; If said difference is an odd number, then said location initial value is deducted 1 as finally locating initial value and positioning.
Adopt the e-book redirect localization method of a kind of portable terminal of the present invention; At first calculate the pairing number of characters of e-book current location read and the difference of said location initial value; And judge the parity of said difference, by pre-defined rule said location initial value is adjusted and positioned again.The present invention can effectively realize the accurate location of GB2312 coded electronic book, takes precautions against the appearance of dislocation mess code, and improves location efficiency.
Description of drawings
Fig. 1 is the main flow chart of the method for the invention;
Fig. 2 is the detail flowchart of one embodiment of the invention.
Embodiment
Further specify technical scheme of the present invention below in conjunction with accompanying drawing and embodiment.
Referring to Fig. 1, Fig. 1 has shown main flow process Figure 100 of the present invention, comprising:
101, obtain the location initial value of said e-book.
Said location initial value obtains by following mode and confirms: during assigned address, said location initial value is the ratio that start byte to be read accounts for this e-book total byte to said e-book in proportion; Said e-book is when the number of pages assigned address, and said location initial value be an appointment number of pages to be read under the certain situation of every page of byte-sized; Said e-book is during by direct specified bytes assigned address, and said location initial value is for specifying the byte of position to be read.
102, read next byte and judge whether to be electronic book documentary end or ascii character, if then change next step.Promptly take off a byte and judge whether to read said electronic book documentary end or read ascii character,, then continue if not to read if then change next step according to sequential read.This step adopts round-robin algorithm to take off a byte according to sequential read, until reading said electronic book documentary end or reading said ascii character.
Specifically, step 102 comprises following substep:
1021, read next byte.
1022, judge whether to read the end of said electronic book documentary,, then change step 1023 if not if then change step 103.
1023, judge whether this byte is ascii character,, then continue if not down to read if then change step 103.
As an embodiment; Step 1022 judges whether to read the end of said electronic book documentary according to following method: current byte position deducts the electronic book documentary initial position and equals electronic book documentary when size, then is judged as the end that reads said electronic book documentary.Step 1023 judges according to following method whether said byte is ascii character: this byte scope then is judged as and reads ascii character during more than or equal to 0x00 and smaller or equal to 0x7f.
103, calculate the pairing number of characters of current location read and the difference of said location initial value.
104, judge whether said difference is even number, if not then by pre-defined rule adjustment location initial value and position, if end operation then.
Specifically, carry out according to the following steps in the step 104: if said difference is an even number, then said location initial value does not adjust and end operation; If said difference is an odd number, then said location initial value is deducted 1 as finally locating initial value and positioning.
With reference to Fig. 2, Fig. 2 has shown detailed process Figure 200 of one embodiment of the invention:
At first, obtain the location initial value, referring to step 201.Said location initial value obtains by following mode and confirms: during assigned address, said location initial value is the ratio that start byte to be read accounts for this e-book total byte to said e-book in proportion; Said e-book is when the number of pages assigned address, and said location initial value be an appointment number of pages to be read under the certain situation of every page of byte-sized; Said e-book is during by direct specified bytes assigned address, and said location initial value is for specifying the byte of position to be read.More than value guarantees that all lowest order is a position.
Secondly, read next byte successively up to meeting end-of-file or ascii character, referring to step 202,203,204 through recycle design.Specifically, current byte position deducts the electronic book documentary initial position and equals electronic book documentary when size, then is judged as the end that reads said electronic book documentary; When this byte scope during, then be judged as and read ascii character more than or equal to 0x00 and smaller or equal to 0x7f.
Once more, calculate current character position and the difference of locating initial value, referring to step 205.
At last, judge the parity of said difference, referring to step 206,207.When difference is even number, explain that location byte that initial value indicates is first byte of certain Chinese character just, locate accurate need not of initial value this moment and adjust; When difference is odd number, explain that the location initial value is wrong, obtain final location initial value thereby need deduct 1, guarantee accurately location jump location.
The present invention is in different intervals according to the encoded radio scope of ascii character with the encoded radio scope of Chinese character and designs.The coding range of ascii character is 0x00 to 0x7f, and GB sign indicating number coding range is 0xA1A1 to 0xF7FE, and the coding of high and low byte is all greater than 0xA1.When reading certain byte and just be in the ascii character coding range; Above-mentioned scope difference can guarantee that this byte is first or second byte of ASCII character rather than Chinese character; Ascii character has been first ascii character since initial value simultaneously, and all bytes all are Chinese character before.To obtain difference should be even number rather than odd number so this character position deducts the correct positioning initial value, so just guaranteed can not misplace the mess code phenomenon.The e-book characteristics that the present invention was suitable for are: the e-book coded format is GB2312, and the encode Chinese characters for computer size is a double byte, and ascii character coding size is a byte.
Traditional e-book jump method is to begin to resolve character from file, locatees until the byte place of redirect.The present invention then is directly from redirect byte location, again through resolving character adjustment backward, skipped the parsing of big section of front and the irrelevant character of this page demonstration, so improved resolution speed greatly.
Those of ordinary skill in the art will be appreciated that; Above embodiment is used for explaining the present invention; And be not to be used as qualification of the present invention; As long as in connotation scope of the present invention, all will drop in claims scope of the present invention variation, the modification of above embodiment.

Claims (7)

1. the e-book redirect localization method of a portable terminal, it is applicable to GB2312 coded electronic book, it is characterized in that, may further comprise the steps:
1.1, obtain the location initial value of said e-book;
1.2, take off a byte and judge whether to read said electronic book documentary end or read ascii character according to sequential read, if then change next step, then continue if not to read;
1.3, calculate the pairing number of characters of current location read and the difference of said location initial value;
1.4, judge whether said difference is even number, then adjust said location initial value and position if not, if end operation then according to pre-defined rule.
2. the method for claim 1; It is characterized in that; Location initial value in the described step 1.1 obtains by following mode and confirms: during assigned address, said location initial value is the ratio that start byte to be read accounts for this e-book total byte to said e-book in proportion; Said e-book is when the number of pages assigned address, and said location initial value be an appointment number of pages to be read under the certain situation of every page of byte-sized; Said e-book is during by direct specified bytes assigned address, and said location initial value is for specifying the byte of position to be read.
3. method as claimed in claim 2 is characterized in that, described step 1.2 comprises following substep:
3.1, read next byte;
3.2, judge whether to read the end of said electronic book documentary, if then change said step 1.3, then change step 3.3 if not;
3.3, judge whether this byte is ascii character, if then change said step 1.3, then continue if not down to read.
4. method as claimed in claim 3; It is characterized in that; Said step 3.2 judges whether to read the end of said electronic book documentary according to following method: current byte position deducts the electronic book documentary initial position and equals electronic book documentary when size, then is judged as the end that reads said electronic book documentary.
5. method as claimed in claim 4 is characterized in that, said step 3.3 judges according to following method whether said byte is ascii character: this byte scope then is judged as and reads ascii character during more than or equal to 0x00 and smaller or equal to 0x7f.
6. method as claimed in claim 5 is characterized in that, said step 1.2 adopts round-robin algorithm to take off a byte according to sequential read, until reading said electronic book documentary end or reading said ascii character.
7. like each described method of claim 1 to 6, it is characterized in that in the said step 1.4: if said difference is an even number, then said location initial value does not adjust and end operation; If said difference is an odd number, then said location initial value is deducted 1 as finally locating initial value and positioning.
CN2011100432533A 2010-07-06 2011-02-23 Electronic-book skipping and positioning method for mobile terminal Pending CN102314413A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2011100432533A CN102314413A (en) 2010-07-06 2011-02-23 Electronic-book skipping and positioning method for mobile terminal

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN201010219519.0 2010-07-06
CN201010219519 2010-07-06
CN2011100432533A CN102314413A (en) 2010-07-06 2011-02-23 Electronic-book skipping and positioning method for mobile terminal

Publications (1)

Publication Number Publication Date
CN102314413A true CN102314413A (en) 2012-01-11

Family

ID=45427596

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2011100432533A Pending CN102314413A (en) 2010-07-06 2011-02-23 Electronic-book skipping and positioning method for mobile terminal

Country Status (1)

Country Link
CN (1) CN102314413A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424337A (en) * 2013-09-11 2015-03-18 北大方正集团有限公司 Document division system and document division method
CN112351107A (en) * 2020-11-16 2021-02-09 百度在线网络技术(北京)有限公司 Method and device for coding file, electronic equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101059800A (en) * 2006-04-21 2007-10-24 上海晨兴电子科技有限公司 Method and apparatus for displaying electronic book on mobile phone
CN101364216A (en) * 2008-09-22 2009-02-11 中兴通讯股份有限公司 Method and device for displaying electronic book documentary on mobile terminal
CN101702149A (en) * 2009-11-12 2010-05-05 深圳市五巨科技有限公司 Method for displaying electronic book with movable terminal and device thereof
CN101763407A (en) * 2009-11-19 2010-06-30 青岛海信移动通信技术股份有限公司 Txt file reading method based on brew platform and reader thereof
CN101763408A (en) * 2009-11-19 2010-06-30 青岛海信移动通信技术股份有限公司 Method for decoding txt file and device thereof, as well as electronic product comprising device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101059800A (en) * 2006-04-21 2007-10-24 上海晨兴电子科技有限公司 Method and apparatus for displaying electronic book on mobile phone
CN101364216A (en) * 2008-09-22 2009-02-11 中兴通讯股份有限公司 Method and device for displaying electronic book documentary on mobile terminal
CN101702149A (en) * 2009-11-12 2010-05-05 深圳市五巨科技有限公司 Method for displaying electronic book with movable terminal and device thereof
CN101763407A (en) * 2009-11-19 2010-06-30 青岛海信移动通信技术股份有限公司 Txt file reading method based on brew platform and reader thereof
CN101763408A (en) * 2009-11-19 2010-06-30 青岛海信移动通信技术股份有限公司 Method for decoding txt file and device thereof, as well as electronic product comprising device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104424337A (en) * 2013-09-11 2015-03-18 北大方正集团有限公司 Document division system and document division method
CN112351107A (en) * 2020-11-16 2021-02-09 百度在线网络技术(北京)有限公司 Method and device for coding file, electronic equipment and readable storage medium
CN112351107B (en) * 2020-11-16 2023-10-03 百度在线网络技术(北京)有限公司 Method, apparatus, electronic device and readable storage medium for encoding file

Similar Documents

Publication Publication Date Title
CN104424165A (en) Messy code detection method and system for text documents
CN101526963A (en) Method for identifying web page coding, device and terminal equipment
CN102567293A (en) Coded format detection method and coded format detection device for text files
CN101655836B (en) Embedded type terminal for converting UTF-8 and GB2312 code, and UTF-8 and GB2312 code conversion method
CN104598902A (en) Method and device for identifying screenshot and browser
CN101916246B (en) Method and device for typesetting electronic document
CN101364216B (en) Method and device for displaying electronic book documentary on mobile terminal
CN103488423A (en) Method and device for implementing bookmark function in electronic reader
CN103336690A (en) HTML (Hypertext Markup Language) 5-based text-element drawing method and device
EP2482231B1 (en) Method for encoding and decoding data on a matrix code symbol
CN104994128A (en) Data coding type identifying and transcoding method and device
CN102479176B (en) Fast-approaching typesetting method and device of electronic reader
CN103150293A (en) Electronic device with messy code recovery function and messy code recovery method
CN105354236A (en) Reconciliation information generation method and system
CN102314413A (en) Electronic-book skipping and positioning method for mobile terminal
CN103970913A (en) UTF-8 (8-bit Unicode transformation format) and ANSI (American national standards institute) code identification method and device
CN101345952B (en) Data storing and reading method, device and system for client identification card
CN102902678A (en) Text content typesetting method and terminal
CN101599264B (en) Method and relevant device for displaying characters on mobile terminal
EP2482230A1 (en) Apparatus and method for decoding matrix code symbol
CN100498808C (en) Printing circuit board element height outputting method and device thereof
CN103634475B (en) The method of display network title and mobile terminal on mobile terminal
US20150242448A1 (en) Secure and lossless data compression
CN104424163A (en) Word processing method and system
CN104216868B (en) A kind of adaptation method and device of document display format

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20120111