1. 程式人生 > >Linux系統下便捷使用中國知網的方式

Linux系統下便捷使用中國知網的方式

本篇文章講解在linux平臺下合理使用中國知網的方式,包括:論文下載,檔名亂碼處理等內容,並提供相應程式碼。
(1)論文下載
背景:由於cnki並未提供linux平臺下的caj閱讀器,同時使用模擬器執行caj閱讀器則可能造成程式崩潰和內容亂碼等的問題,使廣大使用者深感痛楚,接下來講解如何快捷下載pdf格式文件,而非cnki推薦的caj格式文件的方法。
1)進入瀏覽器外掛管理頁面,搜尋:Greasemonkey,下載並安裝油猴子瀏覽器外掛。安裝後請重啟瀏覽器。


2)點選下方連結進入Greasemonkey指令碼下載頁面,瀏覽器將自動安裝指令碼。

3)點選下載圖示,可直接下載pdf格式文件,而非cnki所預設的caj格式文件。同時博碩士論文下載選項處出現PDF下載選項。


(2)檔名稱亂碼處理

Linux系統下可推薦 convmv 程式進行檔名編碼格式轉換。

首先安裝並安裝 convmv 程式,方式為:

[email protected]:~$sudo apt install convmv

注:該方式適用於Ubuntu系統,其他Linux系統的下載方式與此類似。

以下為convmv的幫助文件:

CONVMV(1)

NAME

convmv -converts filenames from one encoding to another

SYNOPSIS

convmv[options] FILE(S) ... DIRECTORY(S)

OPTIONS

-f ENCODING

specifythe current encoding of the filename(s) from which should beconverted

-t ENCODING

specifythe encoding to which the filename(s) should be converted

--nosmart

bydefault convmv will detect if a filename is already UTF8 encoded andwill skip this file if conversion from some charset to UTF8 should beperformed. "--nosmart" will also force conversion to UTF-8for such files, which might result in "double encoded UTF-8"(see section below).

--nosmart

bydefault convmv will detect if a filename is already UTF8 encoded andwill skip this file if conversion from some charset to UTF8 should beperformed. "--nosmart" will also force conversion to UTF-8for such files, which might result in "double encoded UTF-8"(see section below).


使用方式較簡單,可將大部分cnki下載文檔名進行編碼轉換。

使用方式為:

1)到達檔案所在目錄。

[email protected]:~$cd ./file

2) 執行程式碼:

[email protected]:~/file$convmv -r -f utf8 -t iso88591 * --nosmart && convmv -r -f gbk -t utf8 * --nosmart

以測試能夠進行轉化操作,同時在操作3進行之前請備份檔案。

3)執行程式碼:

[email protected]:~/file$convmv -r -f utf8 -t iso88591 * --notest --nosmart && convmv -r -f gbk -t utf8 * --notest --nosmart

以非測試的方式進行轉化,注意這種方式可能會破壞檔案。

以Ubuntu 16.04系統convmv 2.0程式下的使用方式為例:

[email protected]:~$cd ./[email protected]:~/file$ls2_5_7_9_ËÄÏõ»ù_2_5__Ê¡ÂÔ__8µÄ·ÅÈȷֽⷴӦ¶¯Á¦Ñ§_Ó¢ÎÄ_ÕÔ·ïÆð[email protected]:~/file$convmv -r -f utf8 -t iso88591 * --nosmart&& convmv -r -f gbk -t utf8 * --nosmartStarting a dry run without changes...mv"./ÐÂÒ»´ú¸ßËÙI_O»¥Á¬PCIExpress½Ó¿ÚÉè¼Æ_ºúÅô.2.pdf" "./��һ������I_O����PCIExpress�ӿ�����_����.2.pdf"No changes to your files done. Would have converted 1 files in 0 seconds.Use --notest to finally rename the files.Starting a dry run without changes...Skipping, already UTF-8: ./ÐÂÒ»´ú¸ßËÙI_O»¥Á¬PCIExpress½Ó¿ÚÉè¼Æ_ºúÅô.2.pdfNo changes to your filesdone. Would have converted 0 files in0 seconds.Use --notest to finally rename the [email protected]:~/file$convmv -r -f utf8 -t iso88591 * --notest --nosmart&& convmv -r -f gbk -t utf8 * --notest --nosmartmv "./2_5_7_9_ËÄÏõ»ù_2_5__Ê¡ÂÔ__8µÄ·ÅÈȷֽⷴӦ¶¯Á¦Ñ§_Ó¢ÎÄ_ÕÔ·ïÆð.pdf" "./2_5_7_9_������_2_5__ʡ��__8�ķ��ȷֽⷴӦ����ѧ_Ӣ��_�Է���.pdf"Ready! I converted1 files in 0 seconds.mv "./2_5_7_9_������_2_5__ʡ��__8�ķ��ȷֽⷴӦ����ѧ_Ӣ��_�Է���.pdf" "./2_5_7_9_四硝基_2_5__省略__8的放熱分解反應動力學_英文_趙鳳起.pdf"Ready! I converted 1 files in 0 [email protected]:~/file$ls2_5_7_9_四硝基_2_5__省略__8的放熱分解反應動力學_英文_趙鳳起.pdf

同時注意單純使用convmv -r -f gbk -t utf8 * --notest –nosmart或convmv -r -f utf8 -t iso88591 * --notest--nosmart命令並不能實現亂碼問題的解決。