Linux scim five 98 code table-general Linux technology-Linux programming and kernel information. The following is a detailed description. The new system was installed yesterday. Fedora 6 is so friendly that it has not been used for LINUX for a long time. Ah, I really miss my college life. It was just over a month since I came out.
SCIM's five-stroke input method is 86. I am not used to it. I did not find the 98 code table everywhere on the Internet. After checking some information, I decided to do it myself. It took about half a day to get it done. We hope to provide a reference for later users. The steps are as follows:
1. Generate the 98's code table file winwb98.txt in windows.
First of all, there should be five 98 installed on the machine, and the code table will generally be located in WINDOWS/SYSTEM, search for ". mb", you can find it, then download imegen.exe, you cannot find it online, and there is no xp system. Finally, we found it using EMULE. Run the imegencommand to convert wubi.mbto winwb98.txt. Note: Be sure to open winwb98.txt and save it as, select the encoding format for the UTF-8.
2. Convert the 86's binformat table on the linux machine to wubi86.txt.
Place the SCIM code table:/usr/share/scim/talbes/. Run scim-make-table Wubi. bin-o Wubi86.txt to export the code table. Copy winwb98.txt to a LINUX machine and change the line break of the file because \ r \ n is used for WINDOWS and \ n is used for LINUX, fortunately, there is a hexadecimal editing software named KHEXEDIT on Fedora. Open winwb98.txt, search for "\ r", that is, "0d", and replace it with null. When you open wubi86.txtand winwb98.txt, you can find that the file header is different. The rest of the content corresponds to the key and value, but the two files have different keys and values. I have found a PERL script on the Internet. I cannot execute any errors, but I don't understand PERL, so I can only write programs by myself. At the beginning, the file is written in C. The generated file after writing is ASCII and cannot be used at all. I will not use any of the wide characters supported by C. So I wrote it in JAVA. The source code is a file that uses a regular expression, which is also a new one today.
Try {
In = new BufferedReader (new InputStreamReader (
New FileInputStream (sourceFileName), encoding ));
Out = new BufferedWriter (new OutputStreamWriter (
New FileOutputStream (destFileName), encoding ));
While (line = in. readLine ())! = Null)
Out. write (getConvertedString (line) + "\ n ");
Out. close ();
In. close ();
} Catch (UnsupportedEncodingException e ){
E. printStackTrace ();
} Catch (IOException e ){
E. printStackTrace ();
}
}
Public String getConvertedString (String in ){
String result;
Pattern p = Pattern. compile ("([\ u4e00-\ u9fa5] *) \ s * ([a-zA-Z] *) \ s * [a-zA-Z] * ");
Matcher m = p. matcher (in );
If (m. matches ()){
Result = m. group (2) + "\ t" + m. group (1 );
} Else {
// Do nothing return the string
Result = in;
System. out. println ("error ");
}
Return result;
}
}
After compilation, put winwb98.txtin the converter.classtutorial directory. Then open winwb98.txt to remove the file header, leaving only those key pairs. Run java Converter winwb98.txt Wubi98.txt. Open wubi86.txtand replace it with the content in wubi98.txt.
### Begin Table data.
BEGIN_TABLE
...
The content of END_TABLE. do not replace the first-level simple code. In wubi86.txt, the content of the code table of SCIM's five 98.
3. Run scim-make-table Wubi86.txt-B-o Wubi. bin. Replace/usr/share/scim/talbes/Wubi. bin.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.