CN111552513B - Character set replacement method and device - Google Patents

Character set replacement method and device Download PDF

Info

Publication number
CN111552513B
CN111552513B CN202010361341.7A CN202010361341A CN111552513B CN 111552513 B CN111552513 B CN 111552513B CN 202010361341 A CN202010361341 A CN 202010361341A CN 111552513 B CN111552513 B CN 111552513B
Authority
CN
China
Prior art keywords
character
target
preset
group
script file
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.)
Active
Application number
CN202010361341.7A
Other languages
Chinese (zh)
Other versions
CN111552513A (en
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.)
Bank of China Ltd
Original Assignee
Bank of China 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 Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202010361341.7A priority Critical patent/CN111552513B/en
Publication of CN111552513A publication Critical patent/CN111552513A/en
Application granted granted Critical
Publication of CN111552513B publication Critical patent/CN111552513B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/76Adapting program code to run in a different environment; Porting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a character set replacement method and a device, wherein the method comprises the following steps: and (3) pre-writing a plurality of verification scripts, wherein each verification script at least comprises a preset character set which is not suitable for a target environment, each preset character set is used for representing a symbol, starting each verification script in a preset production time period to verify each preset character set contained in the verification script, verifying a target script file, and regarding each preset character set, if the character set consistent with the preset character set exists in the target script file, taking the character set as a character set to be replaced, and replacing the character set to be replaced with the target character set. Therefore, according to the technical scheme provided by the invention, the method and the device for verifying the character set in the target script file, which are not applicable to the target environment, can be started and pre-written in a timing manner, and can be automatically verified and replaced, so that manual intervention is not needed in the whole process, the speed of verifying and replacing the character set is increased, and the production efficiency of the target script file is improved.

Description

Character set replacement method and device
Technical Field
The present invention relates to the field of script file migration technology, and in particular, to a method and an apparatus for replacing a character set.
Background
In different running environments, the same symbol may have different corresponding character sets, for example, the carriage return symbol is represented by 'r/n' in the Windows environment and is represented by 'n' in the Linux environment, so that a script file written in the Windows environment is transplanted to the Linux environment, and a part of character sets cannot be suitable for the Linux environment, so that the script file cannot normally run in the Linux environment, and in order to enable the script file written in the Windows environment to normally run in the Linux environment, the character sets which cannot be suitable for the Linux environment are replaced in the transplanted script file before production.
The existing character set replacement method is that the character set in the script file is checked manually, and the character set which cannot be operated is replaced. And the character groups are manually checked and replaced, so that the speed is low, the efficiency is low, and the production of script files is affected.
Disclosure of Invention
The invention provides a character set replacement method and device, and aims to solve the problems that the verification and replacement of character sets are manually performed, the speed is low, the efficiency is low, and the production of script files is affected.
In order to achieve the above object, the present invention provides the following technical solutions:
a character set replacement method comprising:
starting each pre-written verification script in a preset production time period; each verification script at least comprises a preset character set which is not applicable to a target environment, each preset character set comprises a plurality of characters which are arranged according to a specific sequence, and each preset character set is used for representing a symbol;
judging whether a character set consistent with the preset character set exists in the target script file aiming at each preset character set, and if so, taking the character set consistent with the preset character set as a character set to be replaced; the target script file is a script file which is transplanted into a target environment and is waiting for production;
aiming at each character group to be replaced, acquiring a target character group corresponding to the character group to be replaced, and replacing the character group to be replaced with the target character group to obtain a new target script file; wherein the target character set is adapted to the target environment.
In the above method, optionally, the determining whether the target script file has a character set consistent with the preset character set includes:
traversing a target script file, and judging whether characters consistent with a first character included in the preset character group exist in the target script file or not;
if so, taking the character of which the target script file is consistent with the first character included in the preset character set as a first target character;
taking the next character of the first target character in the target script file as a second target character, and taking the second character in the preset character set as a second character;
comparing the second target character with the second character;
if the comparison is consistent, judging whether the second character is the last character in the preset character group, if the second character is not the last character in the preset character group, taking the next character of the second target character in the target script file as a new second target character, taking the next character of the second character in the preset character group as a new second character, and returning to execute the process of comparing the second target character with the second character until the new second character is the last character in the preset character group, combining the first target character and each second target character into a character group in sequence, and judging that the character group consistent with the preset character group exists in the target script file.
The method, optionally, the obtaining a target character set corresponding to the character set to be replaced includes:
and mapping the character group to be replaced to a pre-constructed character group replacement table to obtain a target character group corresponding to the character to be replaced.
In the above method, optionally, after replacing the character set to be replaced with the target character set to obtain a new script file, the method further includes:
and at the cut-off time point of the production time period, producing the new target script file.
The method, optionally, the starting each pre-written verification script includes:
and starting each pre-written verification script according to a preset script starting command.
A character set replacement apparatus comprising:
the starting unit is used for starting each pre-written verification script in a preset production time period; each verification script at least comprises a preset character set which is not applicable to a target environment, each preset character set comprises a plurality of characters which are arranged according to a specific sequence, and each preset character set is used for representing a symbol;
the judging unit is used for judging whether the character set consistent with the preset character set exists in the target script file aiming at each preset character set, and if so, the character set consistent with the preset character set is used as a character set to be replaced; the target script file is a script file which is transplanted into a target environment and is waiting for production;
the replacing unit is used for acquiring a target character set corresponding to each character set to be replaced according to each character set to be replaced, and replacing the character set to be replaced with the target character set to obtain a new target script file; wherein the target character set is adapted to the target environment.
In the above apparatus, optionally, the determining unit performs determining whether a character group consistent with the preset character group exists in the target script file, for:
traversing a target script file, and judging whether characters consistent with a first character included in the preset character group exist in the target script file or not;
if so, taking the character of which the target script file is consistent with the first character included in the preset character set as a first target character;
taking the next character of the first target character in the target script file as a second target character, and taking the next character of the first character in the preset character set as a second character;
comparing the second target character with the second character;
if the comparison is consistent, judging whether the second character is the last character in the preset character group, if the second character is not the last character in the preset character group, taking the next character of the second target character in the target script file as a new second target character, taking the next character of the second character in the preset character group as a new second character, and returning to execute the process of comparing the second target character with the second character until the new second character is the last character in the preset character group, combining the first target character and each second target character into a character group in sequence, and judging that the character group consistent with the preset character group exists in the target script file.
In the above apparatus, optionally, the replacing unit performs obtaining a target character group corresponding to the character group to be replaced, for:
and mapping the character group to be replaced to a pre-constructed character group replacement table to obtain a target character group corresponding to the character to be replaced.
The above device, optionally, further comprises:
and the production unit is used for producing the new target script file at the cut-off time point of the production time period.
The above device, optionally, the starting unit includes:
and the promoter unit is used for starting each pre-written verification script according to a preset script starting command.
A storage medium comprising stored instructions that, when executed, control a device on which the storage medium resides to perform the character set replacement method described above.
An electronic device comprising a memory, and one or more instructions, wherein the one or more instructions are stored in the memory and configured to perform the above-described character set replacement method by one or more processors.
Compared with the prior art, the invention has the following advantages:
the invention provides a character set replacement method and a device, wherein the method comprises the following steps: and (3) pre-writing a plurality of calibration scripts, wherein each calibration script at least comprises a preset character group which is not suitable for the target environment, each preset character group comprises a plurality of characters which are arranged according to a specific sequence, each preset character group is used for representing a symbol, starting each pre-written calibration script in a preset production time period, and calibrating a target script file by using each preset character group contained in each calibration script, wherein the target script file is transplanted to the target environment and waits for the produced script file, and aiming at each preset character group, if a character group consistent with the preset character group exists in the target script file, the character group is not suitable for the target environment, the character group is used as a character group to be replaced, and the character group to be replaced is replaced by the target character group. Therefore, according to the technical scheme provided by the invention, a plurality of calibration scripts are started in advance at fixed time, the target script file is calibrated by each preset character set contained in each calibration script, each character set which is not applicable to the target environment is searched, each character set which is not applicable to the target environment is replaced by the character set applicable to the target environment, manual intervention is not needed in the whole process, a great amount of time cost is saved, and the calibration and replacement speeds of the character sets are improved, so that the production efficiency of the target script file is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for character set replacement according to the present invention;
FIG. 2 is a flowchart of a method for replacing character sets according to the present invention;
FIG. 3 is a schematic diagram of a character set replacing device according to the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention is operational with numerous general purpose or special purpose computing device environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet devices, multiprocessor devices, distributed computing environments that include any of the above devices or devices, and the like.
The embodiment of the invention provides a character set replacement method, which can be applied to various system platforms, wherein an execution body of the method can be operated on a computer terminal or a processor of various mobile devices, and a flow chart of the method is shown in fig. 1, and specifically comprises the following steps:
s101, starting each pre-written verification script in a preset production time period.
A plurality of verification scripts are pre-written, each verification script at least comprises a preset character set in an inapplicable target environment, each preset character set comprises a plurality of characters arranged according to a specific sequence, each preset character set is used for representing a symbol, that is, a plurality of characters arranged according to the specific sequence contained in the preset character set form a symbol, for example, each character in a character set 'r\n' is arranged according to the specific sequence, and the character set 'r\n' represents a carriage return symbol.
It should be noted that, in the embodiment of the present invention, the number of preset character sets included in the calibration scripts is not specifically limited, each calibration script may include one or more preset character sets, and optionally, each calibration script may include the same preset character set, or preset character sets included in each calibration script are different from each other.
For example, the pre-written verification scripts are verification script a, verification script B, verification script C, and verification script D, which may include the following cases:
(1) The verification script A comprises 3 preset character sets, namely a preset character set 1, a preset character set 2 and a preset character set 3; the verification script B comprises 1 preset character group which is a preset character 3; the verification script C comprises 2 preset character groups, namely preset characters 2 and preset characters 4; the preset checking script comprises 2 preset character groups, namely preset characters 5 and preset characters 6.
(2) The verification script A comprises 3 preset character sets, namely a preset character set 1, a preset character set 2 and a preset character set 3; the verification script B comprises 1 preset character group which is preset character 4; the verification script C comprises 2 preset character groups, namely preset characters 5 and preset characters 6; the preset checking script comprises 2 preset character groups, namely preset characters 7 and preset characters 8.
It should be noted that the same preset character set is used to check the same symbol which is not suitable for the target environment, and different preset character sets are used to check different symbols.
Starting each verification script within a preset production time period, wherein the production time period is a preset time period before production, for example, 5-point production, and the production time period can be 00:00-05:00. It should be noted that, the production time period is a preset time period set for a person, and can be adjusted according to actual needs.
Optionally, a script start command may be preset, and each verification script written in a preset manner may be started by using the preset script start command, which may specifically include, but is not limited to, starting each verification script in a preset production time period by using a crontab command in Linux.
S102, judging whether a character set consistent with the preset character set exists in the target script file according to each preset character set.
For each preset character group, judging whether the character group consistent with the preset character group exists in the target script file, namely, for each preset character group, searching whether the character group identical with the preset character group exists in the target script file, wherein the character group identical with the preset character group is defined as that all characters contained in the character group are identical with all characters contained in the preset character group, and the arrangement sequence of all the characters in the character group is identical with the arrangement sequence of all the characters in the preset character group. The target character set is a script file which is transplanted to the target environment and is ready for production.
In the embodiment of the invention, the target environment is the environment of producing the target script file, the target environment and the writing environment of the target script file are different environments, and optionally, the target environment can be a Linux environment, and the writing environment of the target script file can be a Windows environment.
For each preset character group, if judging that the character group consistent with the preset character group does not exist in the target script file, directly ending, namely ending the verification process of the target script file by the preset character group; if it is determined that the target script file has a character set consistent with the preset character set, step S103 is performed.
It should be noted that, each calibration script is executed sequentially, that is, after the calibration of the target script file with each preset character set included in the current calibration script is completed, the target script file can be calibrated with each preset character set included in the next calibration script.
It should be noted that, the character set replacement method provided by the embodiment of the present invention does not specifically limit the execution sequence of each verification script.
S103, taking the character set consistent with the preset character set in the target script file as a character set to be replaced.
For each preset character group, if a character group consistent with the preset character group exists in the target script file, the character group which is not suitable for the target environment exists in the target script file, namely, the character group which is unsuitable for the target environment exists in the target script file, for example, if the target environment is a Linux environment, the writing environment of the target script file is a Windows environment, and when a carriage return character exists in the target script file, namely, when the character group 'r\n' exists, the character group 'r\n' is used as a character to be replaced.
S104, acquiring a target character set corresponding to each character set to be replaced, and replacing the character set to be replaced with the target character set to obtain a new target script file.
And acquiring a target character set corresponding to each character set to be replaced according to each character set to be replaced, wherein the target character set is used for representing a symbol, and comprises a plurality of characters sequenced according to a specific sequence, and is suitable for a target environment.
For each character group to be replaced, acquiring a target character group corresponding to the character group to be replaced specifically may include: and aiming at each character group to be replaced, searching a corresponding relation between a preset character group and a target character group stored in advance according to the preset character group corresponding to the character group to be replaced, and obtaining the target character group corresponding to the character group to be replaced.
Optionally, the stored correspondence between the preset character set and the target character set may be stored, including but not limited to, in a table, that is, the correspondence between the preset character set and the target character set may be stored in a pre-constructed character set substitution table.
Optionally, if the correspondence between the preset character set and the target character set is stored in a pre-constructed character set replacement table, a process of obtaining the target character set corresponding to the character set to be replaced specifically includes: mapping the character set to be replaced into a pre-constructed character set replacement table to obtain target character sets corresponding to the character set to be replaced, namely mapping the preset character sets into the character set replacement table according to the preset character sets corresponding to the character sets to be replaced aiming at each character set to be replaced to obtain the target character sets corresponding to the characters to be replaced.
For each character group to be replaced, replacing the character group to be replaced with a target character group according to the obtained target character group corresponding to the character group to be replaced, for example, replacing the character group to be replaced with 'r\n', wherein the target character group corresponding to the character group to be replaced is 'n', and replacing 'r\n' in the target script file with 'n'. And after the replacement of all the character groups to be replaced is completed, obtaining a new target script file.
According to the character set replacement method provided by the embodiment of the invention, each pre-written verification script is started in a preset production time period, each preset character set in each verification script is used for verifying the target script file, if each preset character set is consistent with the preset character set in the target script file, the character set is indicated to be unsuitable for a target environment, the character set is taken as a character set to be replaced, and the character set to be replaced is replaced as a target character set. Therefore, by applying the character set replacement method provided by the embodiment of the invention, a plurality of pre-written verification scripts are started at regular time, each preset character set contained in each verification script is used for verifying the target script file, each character set unsuitable for the target environment is searched, each character set unsuitable for the target environment in the target script file is replaced by the character set suitable for the target environment, manual intervention is not needed in the whole process, a great amount of time cost is saved, and the speed of checking and replacing the character sets is improved, so that the production efficiency of the target script file is improved.
The above-mentioned step S102 of the embodiment of the present invention disclosed in fig. 1 involves determining whether a character set consistent with a preset character set exists in the target script file, and the flowchart is shown in fig. 2, and specifically includes the following steps:
s201, traversing the target script file, and judging whether characters consistent with the first characters included in the preset character group exist in the target script file.
Traversing the target script file, comparing the first character in the preset character set with each character in the target script file, executing step S202 if the character which is the same as the first character in the preset character set does not exist in the target script file, and executing step S203 if the character which is the same as the first character in the preset character set exists in the target file.
S202, judging that the character group consistent with the preset character group does not exist in the target script file.
If the character which is the same as the first character in the preset character group does not exist in the target script file, judging that the character group which is consistent with the preset character group does not exist in the target script file.
S203, taking the character which is consistent with the first character included in the preset character set in the target script file as a first target character, taking the next character of the first target character in the target script file as a second target character, and taking the second character in the preset character set as a second character.
If the character which is the same as the first character in the preset character group exists in the target script file, the character in the target script file is taken as a first target character, the first character of the first target character in the target script file is taken as a second target character, and the second character in the preset character group is taken as a second character.
S204, judging whether the second target character is consistent with the second character comparison.
And comparing the second target character with the second character, if the comparison is consistent, executing step S205, and if the comparison is inconsistent, executing step S206.
S205, judging whether the second character is the last character in the preset character group.
If the second target character is identical to the second character, it is determined whether the second character is the last character in the preset character set, if so, step S207 is executed, and if not, step S208 is executed.
S206, judging whether the second target character is the last character in the target script file.
If the second target character is inconsistent with the second character comparison, judging whether the second target character is the last character in the target script file, if the second target character is the last character in the target script file, describing that the target script file is traversed, executing step S202, and if the second target character is not the last character in the target script file, describing that a character group consistent with the preset character group may exist in the target script file, and executing step S201.
S207, judging that a character group consistent with the preset character group exists in the target script file.
If the second target character is consistent with the second character by comparison, and the second character is the last character in the preset character group, judging that the character group consistent with the preset character group exists in the target script file, namely, the character group formed by the first target character and each second target character is consistent with the preset character group.
S208, taking the next character of the second target character in the target script file as a new second target character, and taking the next character of the second character in the preset character set as a new second character.
If the second character is not the last character in the preset character set, taking the next character of the second character in the preset character set as a new second character, taking the next character of the second target character in the target script file as a new second target character, and returning to execute the step S204 according to the second target character and the new second character, namely comparing the new second target character with the new second character
S209, judging whether the second target character is the last character in the target script file.
Judging whether the second target character is the last character in the target script file, if so, directly ending, otherwise, indicating that the target script file may further have a character set consistent with the preset character set, and executing step S201.
In the character set replacing method provided by the embodiment of the invention, whether one or more character sets corresponding to the preset character set exist in the target script file is searched by traversing the target script file.
The steps disclosed in fig. 1 of the above embodiment of the present invention may further include the following steps:
and at the deadline of the production time period, producing the new target script file.
According to the character set replacement method provided by the embodiment of the invention, a new target script file is put into production at the deadline of the production time period, and the character set consistent with any one preset character set is not existed in the target script file, so that each symbol contained in the target script file is applicable to the target environment without replacement, and the target script file is put into production at the deadline of the production time period.
Corresponding to the method shown in fig. 1, the embodiment of the present invention further provides a character set replacing device, which is used for implementing the method in fig. 1, and the schematic structural diagram is shown in fig. 3, and specifically includes:
a starting unit 301, configured to start each pre-written verification script in a preset production time period; each verification script at least comprises a preset character set which is not applicable to a target environment, each preset character set comprises a plurality of characters which are arranged according to a specific sequence, and each preset character set is used for representing a symbol;
a judging unit 302, configured to judge, for each of the preset character sets, whether a character set consistent with the preset character set exists in the target script file, and if so, take the character set consistent with the preset character set as a character set to be replaced; the target script file is a script file which is transplanted into a target environment and is waiting for production;
a replacing unit 303, configured to obtain, for each of the character groups to be replaced, a target character group corresponding to the character group to be replaced, and replace the character group to be replaced with the target character group, to obtain a new target script file; wherein the target character set is adapted to the target environment.
According to the character set replacing device provided by the embodiment of the invention, each pre-written verification script is started in a preset production time period, the target script file is verified by each preset character set in each verification script, if each preset character set exists in the target script file, the character set is indicated to be unsuitable for a target environment, the character set is taken as a character set to be replaced, and the character set to be replaced is replaced as a target character set. Therefore, by applying the character set replacing device provided by the embodiment of the invention, a plurality of pre-written verification scripts are started at regular time, each preset character set contained in each verification script is used for verifying the target script file, each character set unsuitable for the target environment is searched, each character set unsuitable for the target environment in the target script file is replaced by the character set suitable for the target environment, manual intervention is not needed in the whole process, a great amount of time cost is saved, and the speed of checking and replacing the character sets is improved, so that the production efficiency of the target script file is improved.
In one embodiment of the present invention, based on the foregoing scheme, the determining unit 302 performs determining whether a character group consistent with the preset character group exists in the target script file, for:
traversing a target script file, and judging whether characters consistent with a first character included in the preset character group exist in the target script file or not;
if so, taking the character of which the target script file is consistent with the first character included in the preset character set as a first target character;
taking the next character of the first target character in the target script file as a second target character, and taking the next character of the first character in the preset character set as a second character;
comparing the second target character with the second character;
if the comparison is consistent, judging whether the second character is the last character in the preset character group, if the second character is not the last character in the preset character group, taking the next character of the second target character in the target script file as a new second target character, taking the next character of the second character in the preset character group as a new second character, and returning to execute the process of comparing the second target character with the second character until the new second character is the last character in the preset character group, combining the first target character and each second target character into a character group in sequence, and judging that the character group consistent with the preset character group exists in the target script file.
In one embodiment of the present invention, based on the foregoing scheme, the replacing unit 304 performs acquisition of a target character group corresponding to the character group to be replaced for:
and mapping the character group to be replaced to a pre-constructed character group replacement table to obtain a target character group corresponding to the character to be replaced.
In one embodiment of the present invention, based on the foregoing scheme, it may be further configured to:
and the production unit is used for producing the new target script file at the cut-off time point of the production time period.
In one embodiment of the invention, based on the foregoing scheme, the starting unit is configured to:
and the promoter unit is used for starting each pre-written verification script according to a preset script starting command.
The embodiment of the invention also provides a storage medium, which comprises stored instructions, wherein the equipment where the storage medium is located is controlled to execute the character set replacement method when the instructions run.
The embodiment of the present invention further provides an electronic device, whose structural schematic diagram is shown in fig. 4, specifically including a memory 401, and one or more instructions 402, where the one or more instructions 402 are stored in the memory 401, and configured to be executed by the one or more processors 403 to perform the following operations by the one or more instructions 402:
starting each pre-written verification script in a preset production time period; each verification script at least comprises a preset character set which is not applicable to a target environment, each preset character set comprises a plurality of characters which are arranged according to a specific sequence, and each preset character set is used for representing a symbol;
judging whether a character set consistent with the preset character set exists in the target script file aiming at each preset character set, and if so, taking the character set consistent with the preset character set as a character set to be replaced; the target script file is a script file which is transplanted into a target environment and is waiting for production;
aiming at each character group to be replaced, acquiring a target character group corresponding to the character group to be replaced, and replacing the character group to be replaced with the target character group to obtain a new target script file; wherein the target character set is adapted to the target environment.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described as different from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other. For the apparatus class embodiments, the description is relatively simple as it is substantially similar to the method embodiments, and reference is made to the description of the method embodiments for relevant points.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in the same piece or pieces of software and/or hardware when implementing the present invention.
From the above description of embodiments, it will be apparent to those skilled in the art that the present invention may be implemented in software plus a necessary general hardware platform. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present invention.
The foregoing describes in detail a method and apparatus for replacing character sets, wherein specific examples are employed to illustrate the principles and embodiments of the present invention, and the above examples are only used to help understand the method and core ideas of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (6)

1. A character set replacement method, comprising:
starting each pre-written verification script in a preset production time period; each verification script at least comprises a preset character set which is not applicable to a target environment, each preset character set comprises a plurality of characters which are arranged according to a specific sequence, and each preset character set is used for representing a symbol; the target environment is a Linux environment;
for each preset character set, judging whether a character set consistent with the preset character set exists in the target script file or not, wherein the judging comprises the following steps: traversing a target script file, and judging whether characters consistent with a first character included in the preset character group exist in the target script file or not; if so, taking the character of which the target script file is consistent with the first character included in the preset character set as a first target character; taking the next character of the first target character in the target script file as a second target character, and taking the second character in the preset character set as a second character; comparing the second target character with the second character; if the comparison is consistent, judging whether the second character is the last character in the preset character group, if the second character is not the last character in the preset character group, taking the next character of the second target character in the target script file as a new second target character, taking the next character of the second character in the preset character group as a new second character, and returning to execute the process of comparing the second target character with the second character until the new second character is the last character in the preset character group, combining the first target character and each second target character into a character group in sequence, and judging that the character group consistent with the preset character group exists in the target script file; if so, taking the character group consistent with the preset character group as a character group to be replaced; the target script file is a script file which is transplanted into a target environment and is waiting for production; the character group consistent with the preset character group means that all characters contained in the character group are identical to all characters contained in the preset character group, and the arrangement sequence of each character in the character group is identical to the arrangement sequence of each character in the preset character group; the writing environment of the target script file is a Windows environment;
mapping the character groups to be replaced into a character group replacement table constructed in advance for each character group to be replaced, obtaining a target character group corresponding to the character groups to be replaced, and replacing the character groups to be replaced with the target character groups to obtain a new target script file; wherein the target character set is adapted to the target environment.
2. The method according to claim 1, wherein after replacing the character set to be replaced with the target character set to obtain a new script file, further comprising:
and at the cut-off time point of the production time period, producing the new target script file.
3. The method of claim 1, wherein the launching of the pre-written respective verification scripts comprises:
and starting each pre-written verification script according to a preset script starting command.
4. A character set replacement apparatus, comprising:
the starting unit is used for starting each pre-written verification script in a preset production time period; each verification script at least comprises a preset character set which is not applicable to a target environment, each preset character set comprises a plurality of characters which are arranged according to a specific sequence, and each preset character set is used for representing a symbol; the target environment is a Linux environment;
a judging unit, configured to judge, for each of the preset character groups, whether a character group consistent with the preset character group exists in the target script file, including: traversing a target script file, and judging whether characters consistent with a first character included in the preset character group exist in the target script file or not; if so, taking the character of which the target script file is consistent with the first character included in the preset character set as a first target character; taking the next character of the first target character in the target script file as a second target character, and taking the second character in the preset character set as a second character; comparing the second target character with the second character; if the comparison is consistent, judging whether the second character is the last character in the preset character group, if the second character is not the last character in the preset character group, taking the next character of the second target character in the target script file as a new second target character, taking the next character of the second character in the preset character group as a new second character, and returning to execute the process of comparing the second target character with the second character until the new second character is the last character in the preset character group, combining the first target character and each second target character into a character group in sequence, and judging that the character group consistent with the preset character group exists in the target script file; if so, taking the character group consistent with the preset character group as a character group to be replaced; the target script file is a script file which is transplanted into a target environment and is waiting for production; the character group consistent with the preset character group means that all characters contained in the character group are identical to all characters contained in the preset character group, and the arrangement sequence of each character in the character group is identical to the arrangement sequence of each character in the preset character group; the writing environment of the target script file is a Windows environment;
the replacing unit is used for mapping the character groups to be replaced into a pre-constructed character group replacing table for each character group to be replaced, obtaining a target character group corresponding to the character groups to be replaced, replacing the character groups to be replaced with the target character groups, and obtaining a new target script file; wherein the target character set is adapted to the target environment.
5. The apparatus as recited in claim 4, further comprising:
and the production unit is used for producing the new target script file at the cut-off time point of the production time period.
6. The apparatus of claim 4, wherein the activation unit comprises:
and the promoter unit is used for starting each pre-written verification script according to a preset script starting command.
CN202010361341.7A 2020-04-30 2020-04-30 Character set replacement method and device Active CN111552513B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010361341.7A CN111552513B (en) 2020-04-30 2020-04-30 Character set replacement method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010361341.7A CN111552513B (en) 2020-04-30 2020-04-30 Character set replacement method and device

Publications (2)

Publication Number Publication Date
CN111552513A CN111552513A (en) 2020-08-18
CN111552513B true CN111552513B (en) 2024-04-16

Family

ID=72002636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010361341.7A Active CN111552513B (en) 2020-04-30 2020-04-30 Character set replacement method and device

Country Status (1)

Country Link
CN (1) CN111552513B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819469A (en) * 2012-07-04 2012-12-12 北京奇虎科技有限公司 Method and system for recovering operating system
JP2015037310A (en) * 2013-08-16 2015-02-23 文鼎科技開發股▲ふん▼有限公司 Multi-character set character code input method, multi-character set character code input system, and device for executing multi-character set character code input program
CN106569939A (en) * 2016-10-28 2017-04-19 上海斐讯数据通信技术有限公司 Multilateral language analysis system and multilateral language analysis method for control script programs
CN106874163A (en) * 2016-12-29 2017-06-20 广州华多网络科技有限公司 A kind of method and system for showing software error code information
CN107231490A (en) * 2017-07-19 2017-10-03 中国银行股份有限公司 Dynamic updates method, client and the server of IOS system applications
CN109358912A (en) * 2018-09-30 2019-02-19 安徽智恒信科技有限公司 A kind of visualization system and method for batch starting micro services
CN109379640A (en) * 2018-09-30 2019-02-22 武汉斗鱼网络科技有限公司 Barrage method of calibration, device, terminal and storage medium based on chained list mode
CN109471634A (en) * 2018-08-28 2019-03-15 上海思立微电子科技有限公司 The inspection method and equipment of source code format
CN109471988A (en) * 2018-10-12 2019-03-15 平安科技(深圳)有限公司 Page info update method, device, computer equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9563635B2 (en) * 2013-10-28 2017-02-07 International Business Machines Corporation Automated recognition of patterns in a log file having unknown grammar

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102819469A (en) * 2012-07-04 2012-12-12 北京奇虎科技有限公司 Method and system for recovering operating system
JP2015037310A (en) * 2013-08-16 2015-02-23 文鼎科技開發股▲ふん▼有限公司 Multi-character set character code input method, multi-character set character code input system, and device for executing multi-character set character code input program
CN106569939A (en) * 2016-10-28 2017-04-19 上海斐讯数据通信技术有限公司 Multilateral language analysis system and multilateral language analysis method for control script programs
CN106874163A (en) * 2016-12-29 2017-06-20 广州华多网络科技有限公司 A kind of method and system for showing software error code information
CN107231490A (en) * 2017-07-19 2017-10-03 中国银行股份有限公司 Dynamic updates method, client and the server of IOS system applications
CN109471634A (en) * 2018-08-28 2019-03-15 上海思立微电子科技有限公司 The inspection method and equipment of source code format
CN109358912A (en) * 2018-09-30 2019-02-19 安徽智恒信科技有限公司 A kind of visualization system and method for batch starting micro services
CN109379640A (en) * 2018-09-30 2019-02-22 武汉斗鱼网络科技有限公司 Barrage method of calibration, device, terminal and storage medium based on chained list mode
CN109471988A (en) * 2018-10-12 2019-03-15 平安科技(深圳)有限公司 Page info update method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN111552513A (en) 2020-08-18

Similar Documents

Publication Publication Date Title
CN110221959B (en) Application program testing method, device and computer readable medium
CN107688541A (en) File reviewing method, device, server and computer-readable recording medium
CN109213505B (en) Server hard disk firmware refreshing method and device
CN106959919B (en) Software testing method and device based on testing path diagram
CN110806866A (en) Generation method and device of front-end management system
CN111241111A (en) Data query method and device, data comparison method and device, medium and equipment
CN112905262A (en) Configuration method and device of aerospace measurement and control system
CN104182266B (en) A kind of application installation method and device
CN111552513B (en) Character set replacement method and device
CN113094625B (en) Page element positioning method and device, electronic equipment and storage medium
CN113297371A (en) Method, device and equipment for generating recommended question library and storage medium
CN107766240A (en) UEFI Shell internal command automatic running detection methods and system
US8739091B1 (en) Techniques for segmenting of hardware trace and verification of individual trace segments
CN108664250B (en) Code processing method and device
CN110569198A (en) Method and device for automatically testing service function
CN110674249B (en) Information processing method and device
CN114968725A (en) Task dependency relationship correction method and device, computer equipment and storage medium
CN113886259A (en) Non-flow popup automatic processing method and system for bank counter system and electronic device
CN111400245B (en) Art resource migration method and device
CN113807975A (en) Method and device for checking information, computer equipment and storage medium
CN112463896A (en) Archive cataloging data processing method and device, computing equipment and storage medium
CN109993590B (en) Electronic invoice issuing method and device, electronic equipment and medium
CN117573561B (en) Automatic test system, method, electronic equipment and storage medium
CN118034777B (en) FTTR-based log management and version control method, FTTR-based log management and version control device, FTTR-based log management and version control equipment and medium
CN111651364B (en) SQL (structured query language) checking method and device under parallel development

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant