CallmeSunnyday / opencc

Automatically exported from code.google.com/p/opencc
0 stars 0 forks source link

自訂辭典轉換後排版亂掉? #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What is the problem? How to reproduce the problem?
有何問題?如何重現問題?

您好,我測試自訂辭典的功能
發現轉換後排版會亂掉
是我使用上有問題嗎?

截圖
http://i.imgur.com/8NPeQ.jpg
http://i.imgur.com/BGOfW.jpg

What version of the product are you using? On what operating system?
您在用什麼版本?在什麼平臺下?

opencc 3.0
Windows 7 x64

Please provide any additional information below.
請把附加信息寫在下面。

附加檔案為

事發截圖兩張
測試設定檔
測試字典檔
轉換前與後的文檔

以上~請查閱
謝謝您

Original issue reported on code.google.com by roy.yu...@gmail.com on 14 Mar 2012 at 7:28

Attachments:

GoogleCodeExporter commented 8 years ago
感謝你細心的反饋。這是因爲 opencc 內部編碼是 Linux 
的換行符 \n ,你自定的辭典換行符默認是 Windows 的換行符 
\n\r 
。這個問題我會在下一個版本修正,但是在修正之前,你可��
�用 EmEditor 將自定的辭典存儲爲 Unix/Linux 換行符格式。

Original comment by byvo...@gmail.com on 14 Mar 2012 at 7:34

GoogleCodeExporter commented 8 years ago
成功了。花了不少時間研究如何在emeditor改成linux的換行格式�
��最後剛巧看到在winMerge軟體發現可以直接轉換。目前全部正�
��運作,轉換後排版沒問題。謝謝了。

Original comment by roy.yu...@gmail.com on 15 Mar 2012 at 4:39

GoogleCodeExporter commented 8 years ago
我看了一下,在代碼的許多地方,fopen(3)用的都是binary模式。

{{{
$ grep -nr fopen *
src/config_reader.c:190:    FILE * fp = fopen(filename, "rb");
src/config_reader.c:198:        fp = fopen(pkg_filename, "rb");
src/dictionary/datrie.c:197:    FILE * fp = fopen(filename, "rb");
src/dictionary/text.c:115:  FILE * fp = fopen(filename,"rb");
src/dictionary_group.c:59:  FILE * fp = fopen(filename, "rb");
src/dictionary_group.c:67:      fp = fopen(new_filename, "rb");
src/tools/opencc.c:43:      fp = fopen(input_file, "r");
src/tools/opencc.c:53:      fpo = fopen(output_file, "w");
src/tools/opencc_dict.c:293:    FILE * fp = fopen(file_name, "wb");
src/tools/opencc_dict.c:350:    fp = fopen("datrie.txt","w");
}}}

其實不用binary模式的時候,libc函數會自動處理不同系統的換�
��符的問題的吧?

Original comment by damage3...@gmail.com on 11 Aug 2012 at 4:25

GoogleCodeExporter commented 8 years ago
我在嘗試修復這個issue,但是我下載test.rar壓縮檔中得到的123.
txt本身排版就是亂的。
http://img.vim-cn.com/48/170142f5b6417b902482fa5983a4f6f86a992f

Original comment by damage3...@gmail.com on 16 Nov 2012 at 5:38

GoogleCodeExporter commented 8 years ago
I've made a commit for this issue on my fork of OpenCC.
https://github.com/maxiaojun/OpenCC/commit/2d49ac2a93eb5191d398b665460558eb7bbd2
63b

The reporter's test case now works even on Linux.

The change is rather small, please review it.

Original comment by damage3...@gmail.com on 16 Nov 2012 at 7:11