hanson0112 / zhpy

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

字符替换问题 #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
问题描述

1. 打印 '''测试半角() 全角()句号。.'''
结果这些全角符号()。被替换成半角。

2. 文件zhdc.py的两个单引号没有替换。
# punctuations
replacedict = {
    "(":"(",
    ")":")",
    "。":".",
    """:'"',
    """:'"',
    "'":"'",
    "'":"'",
    ",":",",
    ":":":",
    "!":"!",
    }

Original issue reported on code.google.com by ren...@gmail.com on 12 Sep 2007 at 2:54

GoogleCodeExporter commented 8 years ago
是的, 因為目前 replacedict 
是作用在全部輸入內容上的。所以碰上符號就替換.
確實是個 bug.

個人較少用到標點符號, 可否能協助提供正確的符號 :) ?

Original comment by gasolin on 13 Sep 2007 at 5:52

GoogleCodeExporter commented 8 years ago
常用,中文输入法中文标点能打出的。
中文标点
,。;:?!()‘’“”【】
每个符号之间没有空格。
英文标点
, . ; : ? ! ( ) ' ' " " [ ] 
每个符号之间均空一格。
不常用,用输入法全角方式才能打出的。
中文标点
 {}[]《》=+-×/
第一个为中文空格
英文标点
  { } [ ] < > = + - * / 
第一个为英文空格,每个符号之间均空一格。

Original comment by ren...@gmail.com on 13 Sep 2007 at 1:47

GoogleCodeExporter commented 8 years ago
感謝, zhpy用的上的應該有這些:

  ; : ! ( ) ' ' " " [ ]

換成字典是

{{{
',':',',
'。':'.',
';':';',
':':':',
'!':'!',
'(':'(',
')':')',
'‘':"'",
'’':"'",
'“':'"',
'”':'"',
'【':'[',
'】':']',
}}}

Original comment by gasolin on 14 Sep 2007 at 1:34

GoogleCodeExporter commented 8 years ago
fixed in 0.9.3

Original comment by gasolin on 15 Sep 2007 at 3:31

GoogleCodeExporter commented 8 years ago
0.9.3还是有问题。
用如下文件去测试,utf-8编码。zhpy -o -i 翻译。
{{{
# 测试
# !(),。;:‘’“”【】{}
  !(),。;:‘’“”【】{}
"""!(),。;:‘’“”【】{}"""
# (),.;:''""[]
  (),.;:''""[]
"""  (),.;:''""[]"""
}}}

输出文件为
{{{
# p_6d4b_8bd5_v
# !(),.;:p_2018_2019_201c_201d_3010_3011_v
  !(),.;:p_2018_2019_201c_201d_3010_3011_v
"""!(),。;:‘’“”【】"""
# (),.;:''""[]
  (),.;:''""[]
"""  (),.;:''""[]"""
}}}

问题列表:
1. '''!(),;:‘’“”【】'''等没有翻译。
2. 注释(# comments)不应被翻译。

Original comment by ren...@gmail.com on 17 Sep 2007 at 6:02

GoogleCodeExporter commented 8 years ago
补充一下,问题1指源代码第三行被错误翻译。有些没有翻译�
��,有些不该被翻译。

Original comment by ren...@gmail.com on 17 Sep 2007 at 12:55

GoogleCodeExporter commented 8 years ago
修好 # 註解不被翻譯 問題

確認只有。被翻譯到,其他符號未被翻譯。 
(測試不完全果然是會有問題的)

Original comment by gasolin on 19 Sep 2007 at 1:09

GoogleCodeExporter commented 8 years ago
fixed in [375]

Original comment by gasolin on 19 Sep 2007 at 10:16

GoogleCodeExporter commented 8 years ago
越討論越發現許多中文符號的問題

http://groups.google.com/group/python-cn/browse_thread/thread/21d716229b2533ab/7
b6b8bda993e6994#7b6b8bda993e6994

Original comment by gasolin on 20 Sep 2007 at 7:32