CN106802882B - Method and device for detecting command line interface coding mode - Google Patents

Method and device for detecting command line interface coding mode Download PDF

Info

Publication number
CN106802882B
CN106802882B CN201611248780.7A CN201611248780A CN106802882B CN 106802882 B CN106802882 B CN 106802882B CN 201611248780 A CN201611248780 A CN 201611248780A CN 106802882 B CN106802882 B CN 106802882B
Authority
CN
China
Prior art keywords
command line
coding mode
prompt
prompt text
mode
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
CN201611248780.7A
Other languages
Chinese (zh)
Other versions
CN106802882A (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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201611248780.7A priority Critical patent/CN106802882B/en
Publication of CN106802882A publication Critical patent/CN106802882A/en
Application granted granted Critical
Publication of CN106802882B publication Critical patent/CN106802882B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The application provides a method and a device for detecting a command line interface coding mode, wherein the method comprises the following steps: after a terminal device where a command line client is located switches a local language mode to a target language supporting non-ASCII characters, a first encoding mode which is locally supported and aims at the target language is determined; and a second encoding mode for the target language supported by the command line client; then outputting a first prompt text which corresponds to the target language and is coded based on the first coding mode at the command line interface; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text. The method and the device solve the problem that when the command line client and the terminal equipment system adopt different encoding modes aiming at the same non-ASCII character language, a user does not know how to configure.

Description

Method and device for detecting command line interface coding mode
Technical Field
The present application relates to the field of character encoding technologies, and in particular, to a method and an apparatus for detecting a command line interface encoding mode.
Background
A command line client is a common computer system configuration tool that a user may manage a system by entering text commands at a command line interface of the command line client. Traditionally, command lines only support input and output in full english, and as computer technology has become widespread and localized around the world, computer devices have begun to support input and output in languages other than english on command line interfaces.
All English characters belong to ASCII (American Standard Code for information exchange) characters, and the encoding mode is fixed, so that the command line interface does not need to do any processing when inputting and outputting English, and for some languages except English, the number of bytes occupied by each character in different encoding modes is different due to the fact that the characters belong to non-ASCII characters. Taking Chinese as an example, Chinese characters occupy 2 bytes in GBK (Chinese Internal Code Specification, Kanji Code character set) family character codes, and occupy 3 bytes in UTF-8(8-bit Unicode Transformation Format). The same Chinese character is completely different in different coding modes, so when the command line client and the computer system adopt different coding modes aiming at the language of which the literal characters do not belong to ASCII characters, the command line client can not act on the computer system.
When the command line client and the computer system use different encodings for the same non-ASCII character language, the user often does not know how they should be configured.
Disclosure of Invention
In view of the above, the present application provides a method and an apparatus for detecting a coding method of a command line interface, so as to solve the problem that when a command line client and a computer system use different coding methods for text characters that do not belong to ASCII characters, the command line interface cannot act on the computer system, and a user does not know how to configure the command line interface.
Specifically, the method is realized through the following technical scheme:
a method for detecting a command line interface coding mode is applied to a terminal device where a command line client is located, and comprises the following steps:
responding to a language switching command input by a user at a command line interface, and switching the language mode of the terminal equipment to a target language supporting non-ASCII characters;
determining a first coding mode which is supported by the terminal equipment and aims at the target language; and a second encoding mode for the target language supported by the command line client;
outputting a first prompt text which corresponds to the target language and is coded based on the first coding mode at the command line interface; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
In the method for detecting the command line interface encoding mode, the method further includes:
when the second coding mode which is supported by the command line client and aims at the target language cannot be determined, the first prompt text which corresponds to the target language and the second prompt text which is coded based on each preset coding mode in a preset coding mode set are output on the command line interface.
In the method for detecting the command line interface encoding mode, the method further includes:
when a third coding mode in the preset coding mode set is a subset of the first coding mode, outputting a third prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the third prompt text comprises special characters which can be correctly analyzed only by the first coding mode; and the number of the first and second groups,
when the first coding mode is a subset of a fourth coding mode in the preset coding mode set, outputting a fourth prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the fourth prompt text comprises special characters which can be correctly analyzed only by the fourth coding mode.
In the method for detecting the command line interface encoding mode, the method further includes:
outputting the second prompt text corresponding to a language edit supporting ASCII characters at the command line interface.
In the method for detecting the command line interface coding mode, the first prompt text is a prompt message which ignores other prompt texts when the current text is normally decoded and displayed; the second prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the current text is normally decoded and displayed; the third prompt text is a prompt message for modifying the coding mode of the command line client into the first coding mode when the special character cannot be decoded and displayed; and the fourth prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the special character is normally decoded and displayed.
A device for detecting a command line interface coding mode is applied to a terminal device where a command line client is located, and comprises:
the switching unit is used for responding to a language switching command input by a user on a command line interface and switching the language mode of the terminal equipment to a target language supporting non-ASCII characters;
a determining unit, configured to determine a first encoding mode for the target language supported by the terminal device; and a second encoding mode for the target language supported by the command line client;
the output unit is used for outputting a first prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
The device for detecting the command line interface coding mode further comprises:
the output unit is further configured to output, on the command line interface, the first prompt text corresponding to the target language and the second prompt text that is encoded based on each preset encoding mode in a preset encoding mode set, when a second encoding mode for the target language supported by the command line client cannot be determined.
The device for detecting the command line interface coding mode further comprises:
the output unit is further configured to output, at the command line interface, a third prompt text corresponding to the target language and encoded based on the first encoding manner when a third encoding manner in the preset encoding manner set is a subset of the first encoding manner; the third prompt text comprises special characters which can be correctly analyzed only by the first coding mode; and the number of the first and second groups,
when the first coding mode is a subset of a fourth coding mode in the preset coding mode set, outputting a fourth prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the fourth prompt text comprises special characters which can be correctly analyzed only by the fourth coding mode.
The device for detecting the command line interface coding mode further comprises:
the output unit is further configured to output the second prompt text corresponding to the language editing supporting ASCII characters at the command line interface.
In the device for detecting the command line interface coding mode, the first prompt text is a prompt message which ignores other prompt texts when the current text is normally decoded and displayed; the second prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the current text is normally decoded and displayed; the third prompt text is a prompt message for modifying the coding mode of the command line client into the first coding mode when the special character cannot be decoded and displayed; and the fourth prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the special character is normally decoded and displayed.
In the application, when a user switches a language mode on a command line interface, a terminal device where a command line client is located responds to the operation of the user, executes a language switching command, and switches the language mode of the terminal device to a target language supporting non-ASCII characters; the terminal device determines a first encoding mode which is locally supported and aims at the target language, and a second encoding mode which is supported by the command line client and aims at the target language; and then outputting a first prompt text corresponding to the target language and based on the first coding mode on the command line interface, and coding a second prompt text based on the second coding mode, so that a user can reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
Through the measures, the user can determine whether the coding modes of the current command line client and the terminal device are the same or not more intuitively, and how to modify the coding mode of the client.
Drawings
FIG. 1 is a flow chart illustrating a method for detecting a command line interface encoding scheme according to the present application;
FIG. 2 is a block diagram of an embodiment of a device for detecting a command line interface encoding mode according to the present disclosure;
fig. 3 is a hardware configuration diagram of an apparatus for detecting a command line interface encoding method according to the present application.
Detailed Description
In order to make the technical solutions in the embodiments of the present invention better understood and make the above objects, features and advantages of the embodiments of the present invention more comprehensible, the following description of the prior art and the technical solutions in the embodiments of the present invention with reference to the accompanying drawings is provided.
Target languages belonging to non-ASCII characters are often incompatible after being encoded by different encoding schemes, and a character encoding of a certain character in one encoding scheme may be parsed into completely different characters (or cannot be parsed and cannot be displayed) in another encoding scheme.
When the command line client processes the characters output from the terminal device where the command line client is located, the byte stream output by the terminal device needs to be analyzed according to the encoding mode configured by the user. When the language mode of the command line client is switched to a target language which belongs to non-ASCII characters, if the coding modes of the command line client and the terminal equipment which are configured aiming at the target language are inconsistent, the non-ASCII characters output by the terminal equipment are displayed as messy codes on a command line interface; and the instruction input to the terminal equipment by the user through the command line interface cannot be recognized by the system of the terminal equipment.
In addition, in a case where the encoding modes configured for the target language by the command line client and the terminal device are not the same, the encoding mode configured on the command line client or the terminal device is a subset of the encoding mode of the other party. For example, the terminal device uses GBK (Chinese Internal Code Specification) encoding, and the command line client uses GB2312 encoding. When the terminal device outputs characters which do not belong to GB2312, the command line interface cannot be normally displayed. Similarly, if the terminal device uses GB2312 encoding and the command line client uses GBK encoding, the terminal device will not recognize when the user enters characters that do not belong to GB 2312.
Therefore, the command line client and the terminal device in which the command line client is located must be configured with the same encoding scheme for a target language that belongs to non-ASCII characters.
However, because the system of different terminal devices and the difference between different command line clients cause inconvenience in management, the encoding method of a command line client for any non-ASCII character may not be the same as the default encoding method of the system of all terminal devices, and the user always needs to set the encoding method of the command line client when managing the system of terminal devices through the command line client. In fact, most of the ordinary users do not understand the principle of character encoding, and do not know which encoding method is used by the system of the terminal device and the command line client, respectively, and how to configure the correct encoding method for the command line client.
In order to solve the problem, according to the technical scheme of the embodiment of the application, when the command line client responds to a language switching command input by a user and switches a language mode to a target language supporting non-ASCII characters, a prompt text which corresponds to the target language and is coded based on a coding mode of the command line client and a prompt text which is coded based on a coding mode of a terminal device are output on a command line interface. And prompting the user to reset the coding mode for the command line client by the prompt text which can be normally decoded and displayed in the prompt text.
Referring to fig. 1, which is a flowchart of a method for detecting a command line interface coding mode shown in the present application, an execution subject of the method is a terminal device where a command line client is located; the method comprises the following steps:
step 101: and responding to a language switching command input by a user at a command line interface, and switching the language mode of the terminal equipment to a target language supporting non-ASCII characters.
Step 102: determining a first coding mode which is supported by the terminal equipment and aims at the target language; and a second encoding mode for the target language supported by the command line client.
Step 103: outputting a first prompt text which corresponds to the target language and is coded based on the first coding mode at the command line interface; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
The command line client comprises a super terminal, a push, a secureCRT and the like of a Windows system.
The terminal device includes a network device, such as a computer, which can install the command line client and respond to a command initiated by a user through the command line client.
Due to the diversity of the system of the terminal device and the command line client, and the diversity of the encoding schemes for the same non-ASCII characters, the selection of the encoding schemes for the same non-ASCII characters by the system of the terminal device and the command line client is likely to be different. In this case, the user needs to configure the encoding mode of the command line client as the encoding mode selected by the terminal device.
The system of the terminal device usually supports only ASCII mode (e.g., english mode) by default, and is actively switched to other characters (e.g., chinese mode) by the user when necessary to input non-ASCII characters. In the embodiment of the application, when a user inputs a language switching command on the command line interface, the terminal device where the command line client is located may switch the language mode of the terminal device to the target language supporting non-ASCII characters in response to the language switching command.
In the embodiment of the application, after the terminal equipment where the command line client is located switches the language mode to the target language, a first locally supported coding mode aiming at the target language can be obtained; and determining a second coding mode which is supported by the command line client and aims at the target language, wherein the terminal device cannot accurately determine the coding mode of the command line client aiming at the target language because an interface of a butt joint coordination coding mode does not exist between the command line client and a system of the terminal device, and therefore the second coding mode is the coding mode of the command line client which is estimated by the terminal device aiming at the target language.
In this embodiment of the present application, after the terminal device where the command line client is located determines the first encoding method and the second encoding method, a first prompt text corresponding to the target language and encoded based on the first encoding method and a second prompt text corresponding to the target language and encoded based on the second encoding method may be constructed. The first prompt text can be a prompt message which ignores other prompt texts when the current text is normally decoded and displayed; the second prompt text may be a prompt message that modifies the encoding mode of the command line client to the first encoding mode when the current text is normally decoded and displayed.
In this embodiment, the terminal device where the command line client is located may output the first prompt text and the second prompt text on a command line interface, so that a user may reset a coding mode for the command line client under a prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
For example: the terminal equipment responds to a language switching command input on the command line interface by a user and switches the local language mode from the English mode to the Chinese mode. The first encoding mode of the terminal equipment for Chinese support is UTF-8(8-bitUnicode Transformation Format), and the second encoding mode of the command line client predicted by the terminal equipment for Chinese support is GBK encoding.
The UTF-8 coding-based first prompt text which is constructed by the terminal equipment and corresponds to Chinese is as follows:
"change to the Chinese mode. The encoding mode of the current command line client is set correctly, please ignore the following information. "
The second prompt text which is constructed by the terminal equipment and corresponds to the Chinese and is based on the GBK codes is as follows:
"change to the Chinese mode. And if the coding mode of the current command line client is set to be wrong, please set the coding mode to be UTF-8. "
In the first case, if the coding mode of the command line client is set correctly, that is, the coding modes of the command line client and the terminal device for chinese configuration are both UTF-8, the first prompt text may be decoded and displayed normally on the command line interface, and the second prompt text may be displayed as a messy code. At this time, the user can know that the coding mode of the command line client is correctly set according to the content of the first prompt text, and the coding mode does not need to be changed.
In the second case, if the coding mode of the command line client is set incorrectly, that is, the coding mode of the command line client is different from the coding mode of the terminal device configured for chinese, and the coding mode configured for the command line client is GBK, the first prompt text is displayed as a messy code on the command line interface, and the second prompt text can be normally decoded and displayed on the command line interface. At this time, the user can know that the encoding mode of the command line client is set incorrectly according to the second prompt text, and the setting needs to be changed to UTF-8.
In an embodiment shown, since the terminal device may not accurately predict the second encoding method for the target language that may be supported by the command line client, the second encoding method may be replaced by a preset encoding method set. The encoding mode set comprises a plurality of encoding modes which can be configured by the command line client.
In this case, the terminal device where the command line client is located may output, in the command line interface, the first prompt text encoded based on the first encoding method, and the second prompt text encoded based on each preset encoding method in the preset encoding method set.
If the coding mode of the command line client is correctly set, the first prompt text can be normally decoded and displayed on a command line interface, and the second prompt text is all messy codes. And the user can know that the coding mode of the command line client is correctly set according to the first prompt text without changing.
In addition, if the coding mode of the command line client is set incorrectly, since the second prompt text is output after being coded by multiple coding modes, in general, one coding mode is always the coding mode configured for the command line client, and the second prompt text coded by the coding mode can be normally decoded and displayed. Therefore, the user can know that the coding mode of the command line client is set incorrectly from the second prompt text which is decoded and displayed normally, and needs to change the coding mode to the first coding mode.
In an embodiment, in order to prevent the terminal device from being unable to predict the second encoding method for the target language that may be supported by the command line client, the user is unable to change the encoding method for the command line client with the wrong configuration into the first encoding method according to the second prompt text displayed by normal decoding. The terminal device may command the line interface to output the second prompt text described above corresponding to the language edit supporting ASCII characters. For example, the terminal device may add a pure english prompt message:
“If all of the information above are unrecognized,DO set thecharacter encoding of the current command line tools to XXX!”
wherein XXX is the first coding mode. The user can know the configuration error of the coding mode of the command line client and change the configuration error according to the last message edited according to the language supporting the ASCII characters.
In this embodiment of the present application, the encoding scheme configured on the command line client may be a subset of the encoding scheme configured on the terminal device, that is, a third encoding scheme exists in the preset encoding scheme combination, and the third encoding scheme is the subset of the first encoding scheme. The first prompt text and the second prompt text can be displayed normally, but the meanings are contradictory to each other, which causes trouble to users.
Therefore, after the terminal device where the command line client is located can obtain the first coding mode and the third coding mode, the third prompt text coded based on the first coding mode is output on the command line interface. The third prompt text may include a special character that can be correctly analyzed only by the first encoding method; the third prompt text may be a prompt message that modifies the encoding mode of the command line client to the first encoding mode when the special character cannot be decoded and displayed.
For example: when the first encoding mode configured by the terminal device for the chinese language is GBK encoding, the third encoding mode possibly configured by the command line client is GB 2312. In this case, the terminal device may output, in the command line interface, a third prompt text including a special character that can be correctly interpreted only by the GBK, where the GBK code includes kanji unique to japan and korea and is not recognized in GB 2312.
The third prompt text may be as follows:
if the characters at the tail of the line can be normally displayed, the coding mode of the current command line client is correctly set, otherwise, the coding mode of the command line client is set as GBK: XX "(XX represents a Chinese character which GB2312 can not resolve and GBK code can resolve)
In the first case, the coding mode of the command line client is the same as that of the terminal device and is GBK coding, then XX can be normally displayed, and the user does not need to change the coding mode;
in the second case, if the coding mode of the command line client is indeed the subset of the coding mode of the terminal device, XX cannot be displayed normally, and the user can set the coding mode of the command line client to the first coding mode through the third prompt text.
In an embodiment shown, the encoding method configured on the terminal device may be a subset of encoding methods configured by the command line client, that is, a fourth encoding method exists in the preset encoding method set, and the first encoding method is the subset of the fourth encoding method. This situation is opposite to the previous situation, but the first prompt text and the second prompt text can be displayed normally, but have contradictory meanings, which causes trouble to the user.
Therefore, after the terminal device where the command line client is located can obtain the first encoding mode and the fourth encoding mode, the fourth prompt text encoded based on the first encoding mode is output on the command line interface. The fourth prompt text may include a special character that can be correctly analyzed only by the fourth encoding method; the fourth prompt text may be a prompt message that modifies the encoding mode of the command line client to the first encoding mode when the special character is normally decoded and displayed.
For example: when the first encoding mode configured by the terminal device for the chinese language is GB2312, the fourth encoding mode that may be configured by the command line client is GBK. In this case, the terminal device may output, on the command line interface, a fourth prompt text including a special character that can be correctly parsed only by the GBK, which may be a chinese character unique to japan and korea in the GBK code and is not recognized in GB 2312.
The fourth prompt text may be as follows:
if the characters at the tail of the line cannot be normally displayed, the encoding mode of the current command line client is correctly set, otherwise, the encoding mode of the command line client is set as GBK: XX "(XX represents a Chinese character which GB2312 can not resolve and GBK code can resolve)
In the first case, the coding mode of the command line client is the same as that of the terminal device, and the command line client is coded in GB2312, then XX cannot be displayed normally, and a user does not need to change the coding mode;
in the second case, if the encoding mode of the terminal device is indeed the subset of the encoding mode of the command line client, XX can be displayed normally, and the user can set the encoding mode of the command line client to the first encoding mode through the fourth prompt text.
In summary, in the embodiment of the present application, when a user inputs a language switching command and selects a target language supporting non-ASCII characters, a terminal device at a command line client switches a local language mode to the target language supporting non-ASCII characters in response to the language switching command input by the user on a command line interface, and then determines a first encoding mode locally supported for the target language and a second encoding mode predicted by the terminal device and supported by the command line client for the target language; and the terminal equipment outputs a first prompt text which corresponds to the target language and is coded based on the first coding mode and a second prompt text which is coded based on the second coding mode on a command line interface.
And outputting a third prompt text encoded based on the first encoding mode in case that the encoding mode of the command line client may be the subset of the first encoding mode, and outputting a fourth prompt text encoded based on the first encoding mode in case that the first encoding mode may be the subset of the encoding mode of the command line client. By the aid of the measures, a user can intuitively know whether the coding mode configured by the command line client is the same as the coding mode configured by the terminal equipment or not through the prompt text on the command line interface, and the coding mode of the command line client is changed into the first coding mode under different conditions.
Corresponding to the embodiment of the method for detecting the command line interface coding mode, the application also provides an embodiment of a device for executing the method embodiment.
Referring to fig. 2, a block diagram of an embodiment of an apparatus for detecting a command line interface encoding manner is shown in the present application:
as shown in fig. 2, the apparatus 20 for detecting the command line interface encoding method includes:
and the switching unit 210 is used for responding to a language switching command input by a user in the command line interface and switching the language mode of the terminal equipment to a target language supporting non-ASCII characters.
A determining unit 220, configured to determine a first encoding manner for the target language supported by the terminal device; and a second encoding mode for the target language supported by the command line client.
An output unit 230, configured to output, on the command line interface, a first prompt text corresponding to the target language and encoded based on the first encoding manner; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
In this example, the apparatus further comprises:
the output unit 230 is further configured to, when a second encoding manner for the target language supported by the command line client cannot be determined, output the first prompt text corresponding to the target language on the command line interface, and output the second prompt text encoded based on each preset encoding manner in a preset encoding manner set.
In this example, the apparatus further comprises:
the output unit 230 is further configured to output, on the command line interface, a third prompt text corresponding to the target language and encoded based on the first encoding manner when a third encoding manner in the preset encoding manner set is a subset of the first encoding manner; the third prompt text comprises special characters which can be correctly analyzed only by the first coding mode; and the number of the first and second groups,
when the first coding mode is a subset of a fourth coding mode in the preset coding mode set, outputting a fourth prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the fourth prompt text comprises special characters which can be correctly analyzed only by the fourth coding mode.
In this example, the apparatus further comprises:
the output unit 230 is further configured to output, at the command line interface, the second prompt text corresponding to a language edit supporting ASCII characters.
In this example, the first prompt text is a prompt message that other prompt texts are ignored when the current text is normally decoded and displayed; the second prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the current text is normally decoded and displayed; the third prompt text is a prompt message for modifying the coding mode of the command line client into the first coding mode when the special character cannot be decoded and displayed; and the fourth prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the special character is normally decoded and displayed.
The embodiment of the device for detecting the command line interface coding mode can be applied to the terminal equipment where the command line client is located. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. Taking a software implementation as an example, as a device in a logical sense, the device is formed by reading a corresponding computer program instruction in a non-volatile memory into an internal memory for operation through a processor of a terminal device where a command line client is located. In terms of hardware, as shown in fig. 3, the present application is a hardware structure diagram of a terminal device where a device for detecting a command line interface coding mode is located, where the terminal device where the device is located in the embodiment may include other hardware according to an actual function of the device for detecting a command line interface coding mode, in addition to the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 3, and this is not described again.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A method for detecting a command line interface coding mode is applied to a terminal device where a command line client is located, and comprises the following steps:
responding to a language switching command input by a user at a command line interface, and switching the language mode of the terminal equipment to a target language supporting non-ASCII characters;
determining a first coding mode which is supported by the terminal equipment and aims at the target language; and a second encoding mode for the target language supported by the command line client;
outputting a first prompt text which corresponds to the target language and is coded based on the first coding mode at the command line interface; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
2. The method of claim 1, further comprising:
when the second coding mode which is supported by the command line client and aims at the target language cannot be determined, the first prompt text which corresponds to the target language and the second prompt text which is coded based on each preset coding mode in a preset coding mode set are output on the command line interface.
3. The method of claim 2, further comprising:
when a third coding mode in the preset coding mode set is a subset of the first coding mode, outputting a third prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the third prompt text comprises special characters which can be correctly analyzed only by the first coding mode; and the number of the first and second groups,
when the first coding mode is a subset of a fourth coding mode in the preset coding mode set, outputting a fourth prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the fourth prompt text comprises special characters which can be correctly analyzed only by the fourth coding mode.
4. The method of claim 1, further comprising:
outputting the second prompt text corresponding to a language edit supporting ASCII characters at the command line interface.
5. The method of claim 3, wherein the first prompt text is a prompt message that ignores other prompt texts when the current text is displayed normally decoded; the second prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the current text is normally decoded and displayed; the third prompt text is a prompt message for modifying the coding mode of the command line client into the first coding mode when the special character cannot be decoded and displayed; and the fourth prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the special character is normally decoded and displayed.
6. A device for detecting a command line interface coding mode is applied to a terminal device where a command line client is located, and comprises:
the switching unit is used for responding to a language switching command input by a user on a command line interface and switching the language mode of the terminal equipment to a target language supporting non-ASCII characters;
a determining unit, configured to determine a first encoding mode for the target language supported by the terminal device; and a second encoding mode for the target language supported by the command line client;
the output unit is used for outputting a first prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; and based on the second prompt text coded by the second coding mode, enabling a user to reset the coding mode for the command line interface under the prompt of normally decoding the displayed prompt text in the first prompt text and the second prompt text.
7. The apparatus of claim 6, further comprising:
the output unit is further configured to output, on the command line interface, the first prompt text corresponding to the target language and the second prompt text that is encoded based on each preset encoding mode in a preset encoding mode set, when a second encoding mode for the target language supported by the command line client cannot be determined.
8. The apparatus of claim 7, further comprising:
the output unit is further configured to output, at the command line interface, a third prompt text corresponding to the target language and encoded based on the first encoding manner when a third encoding manner in the preset encoding manner set is a subset of the first encoding manner; the third prompt text comprises special characters which can be correctly analyzed only by the first coding mode; and the number of the first and second groups,
when the first coding mode is a subset of a fourth coding mode in the preset coding mode set, outputting a fourth prompt text which corresponds to the target language and is coded based on the first coding mode on the command line interface; the fourth prompt text comprises special characters which can be correctly analyzed only by the fourth coding mode.
9. The apparatus of claim 6, further comprising:
the output unit is further configured to output the second prompt text corresponding to the language editing supporting ASCII characters at the command line interface.
10. The apparatus according to claim 8, wherein the first prompt text is a prompt message that ignores other prompt texts when the current text is displayed normally decoded; the second prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the current text is normally decoded and displayed; the third prompt text is a prompt message for modifying the coding mode of the command line client into the first coding mode when the special character cannot be decoded and displayed; and the fourth prompt text is a prompt message which modifies the coding mode of the command line client into the first coding mode when the special character is normally decoded and displayed.
CN201611248780.7A 2016-12-29 2016-12-29 Method and device for detecting command line interface coding mode Active CN106802882B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611248780.7A CN106802882B (en) 2016-12-29 2016-12-29 Method and device for detecting command line interface coding mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611248780.7A CN106802882B (en) 2016-12-29 2016-12-29 Method and device for detecting command line interface coding mode

Publications (2)

Publication Number Publication Date
CN106802882A CN106802882A (en) 2017-06-06
CN106802882B true CN106802882B (en) 2020-03-06

Family

ID=58985153

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611248780.7A Active CN106802882B (en) 2016-12-29 2016-12-29 Method and device for detecting command line interface coding mode

Country Status (1)

Country Link
CN (1) CN106802882B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101662162B1 (en) * 2016-03-18 2016-10-10 주식회사 블랙포트시큐리티 User action detecting method for backtracking of infection way of vicious code

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8566806B2 (en) * 2005-03-04 2013-10-22 Microsoft Corporation Command-line data-type discovery and conversion
CN101876907B (en) * 2010-05-18 2014-08-13 杭州海康威视数字技术股份有限公司 Multi-language implementation method and device of human-computer interaction interface
CN102479075A (en) * 2010-11-23 2012-05-30 中兴通讯股份有限公司 Multi-language display method and device in embedded device
CN104951364B (en) * 2014-03-31 2019-01-29 Tcl集团股份有限公司 A kind of language switching method and system based on Android platform
CN104092514A (en) * 2014-07-08 2014-10-08 深圳市同洲电子股份有限公司 Encoding mode switching method and device
CN105955967A (en) * 2016-06-27 2016-09-21 乐视控股(北京)有限公司 Data processing method and data processing device

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101662162B1 (en) * 2016-03-18 2016-10-10 주식회사 블랙포트시큐리티 User action detecting method for backtracking of infection way of vicious code

Also Published As

Publication number Publication date
CN106802882A (en) 2017-06-06

Similar Documents

Publication Publication Date Title
US9621496B2 (en) Correction of incoming messaging
CN110891057B (en) Protocol conversion method, device, equipment and storage medium
JP6340994B2 (en) Printer, printing system, and printing control method
US20160170958A1 (en) Messaging auto-correction using recipient feedback
CN109782997B (en) Data processing method, device and storage medium
CN104252531A (en) File type identification method and device
WO2022222589A1 (en) Method and apparatus for controlling air conditioner, and server
CN106802882B (en) Method and device for detecting command line interface coding mode
CN110377888B (en) HTML-based manuscript auditing editor real-time trace marking method and device
CN103793321B (en) application program detection method and system
CN103294547A (en) Input method calling method, input method calling device and terminal
CN101149669A (en) Words coded conversion method
JPH07175629A (en) Character code converting device
CN102857355B (en) A kind of method and device of message adaptation
US20230214577A1 (en) Character string transmission method and device, computer, and readable storage medium
CN111917559B (en) Text wireless transmitter and system based on USB
CN103472991A (en) Method, equipment and system for adding contacts
KR101668441B1 (en) Meddleware Interface System and Method for Data Collection of Heterogeneous Devices
CN107729302B (en) Decoding algorithm determination method, device, terminal and storage medium
CN107422875B (en) Information management method and system based on command line CLI
JP6280089B2 (en) Whitelist creation device, whitelist creation method, and whitelist creation program
CN107770844B (en) Decoding algorithm determination method, device, terminal and storage medium
CN109343901B (en) Cross-software switching method and device and electronic equipment
JP7357030B2 (en) Communication terminal, program, and display method
CN101950199A (en) Method, device and system for word processing

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