2004年03月08日 星期一 16:23
我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! *************************************************************************************** This e-mail and its attachments contain confidential information from HUAWEI, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it! ***************************************************************************************** -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040308/8bed4e1b/attachment.htm
2004年03月08日 星期一 16:23
可以到jython.sf.net上看看。 >From: "Zoom.Quiet" <zoomq at infopro.cn> >Reply-To: "Zoom.Quiet" <zoomq at itcase.com>, zoomq at infopro.cn, >To: "@Chinese-python" <python-chinese at lists.python.cn> >Subject: [python-chinese] 如何访问外国的编程站点? >Date: Mon, 8 Mar 2004 16:21:07 +0800 > >Hello , > > 就是哪! >在下一直没有上过Jython! >辗转下载到了一个Jython 还不好用!!! >请有办法的同志们提点一下子是也乎?? > >+++++++++++++++++++++++++++++++++++ >很多编程网站都上不了,如www.jython.org,wxpython.org,郁闷。 >另,建议这个主题另开一个thread,不要接在这个后面。 >-- >Best regards, > Zoom.Quiet > > > /=======================================\ >]Time is unimportant, only life important![ > \=======================================/ > >_______________________________________________ >python-chinese mailing list >python-chinese at lists.python.cn >http://python.cn/mailman/listinfo/python-chinese _________________________________________________________________ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn
2004年03月08日 星期一 16:25
我有一个二进制文件,是用C程序生成的,内容是每4个字节为一个long int。现在用python将它读出到一个list of int里。可是file.read(4)返回的是一个4字节长的str,怎么把它转换成int呢?难道要自己一个字节一个字节的ord()出来然后做移位? Qiangning Hong -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040308/d0a1f98e/attachment.html
2004年03月08日 星期一 16:38
Hello d24471, http://www.zqstudio.org:9085/Zoom_Quiet/Nucleus/index.php?itemid=132 有一些, 不过.Apache 本身对于流通的编码没有要求, MySQL 更加不会挑剔! XML 根本与编码没有关系,只要声明一下子就好! 你的问题主要在哪里? === [ 16:23 ; 04-03-08 ] you wrote: d> 我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! d> *************************************************************************************** d> This e-mail and its attachments contain confidential d> information from HUAWEI, which is intended only for the person or d> entity whose address is listed above. Any use of the information d> contained herein in any way (including, but not limited to, total d> or partial disclosure, reproduction, or dissemination) by persons d> other than the intended recipient(s) is prohibited. If you receive d> this e-mail in error, please notify the sender by phone or email d> immediately and delete it! d> ***************************************************************************************** === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月08日 星期一 16:42
我在运行一个范例程序,是用cgi方式做的论坛,我试着输入中文的时候得到一些报错,如下: 范例可以从http://www.deitel.net/registration/registrationForm.asp?ultimateDestination=http://www.deitel.com/books/pythonHTP1/pythonHTP1_examples.zip下载是第16章的范例。 这些报错把我搞迷糊了,不知道是那里的问题? ================================== [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] Premature end of script headers: default.py [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] Traceback (most recent call last): [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] File "D:/Apache Group/Apache2/cgi-bin/default.py", line 34, in ? [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] document = reader.fromStream( XMLFile ) [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\reader\PyExpat.py", line 65, in fromStream [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] success = self.parser.ParseFile(stream) [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] xml.parsers.expat.ExpatError: no element found: line 7, column 10 ----- Original Message ----- From: "Zoom.Quiet" <zoomq at infopro.cn> To: "d24471" <duyuming at huawei.com> Cc: <python-chinese at lists.python.cn> Sent: Monday, March 08, 2004 4:38 PM Subject: Re: [python-chinese] 如何让python脚本支持中文? > Hello d24471, > > http://www.zqstudio.org:9085/Zoom_Quiet/Nucleus/index.php?itemid=132 > 有一些, > 不过.Apache 本身对于流通的编码没有要求, > MySQL 更加不会挑剔! > XML 根本与编码没有关系,只要声明一下子就好! > 你的问题主要在哪里? > > === [ 16:23 ; 04-03-08 ] you wrote: > > d> 我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! > d> *************************************************************************************** > d> This e-mail and its attachments contain confidential > d> information from HUAWEI, which is intended only for the person or > d> entity whose address is listed above. Any use of the information > d> contained herein in any way (including, but not limited to, total > d> or partial disclosure, reproduction, or dissemination) by persons > d> other than the intended recipient(s) is prohibited. If you receive > d> this e-mail in error, please notify the sender by phone or email > d> immediately and delete it! > d> ***************************************************************************************** > > === === === === === === === === === === > > -- > Best regards, > Zoom.Quiet > > /=======================================\ > ]Time is unimportant, only life important![ > \=======================================/ >
2004年03月08日 星期一 16:47
Hello d24471, http://www.zqstudio.org:9085/Zoom_Quiet/Nucleus/index.php?itemid=132 有一些, 不过.Apache 本身对于流通的编码没有要求, MySQL 更加不会挑剔! XML 根本与编码没有关系,只要声明一下子就好! 你的问题主要在哪里? CGI 的话在下有一点经验,比较乱,而且仅仅是IIS下面的CGI方式: http://www.chinesepython.org/cgi_bin/moingb.cgi/_b7_a2_b1_ed_3aPython_2dCGI_2dcn#preview === [ 16:23 ; 04-03-08 ] you wrote: d> 我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! d> *************************************************************************************** d> This e-mail and its attachments contain confidential d> information from HUAWEI, which is intended only for the person or d> entity whose address is listed above. Any use of the information d> contained herein in any way (including, but not limited to, total d> or partial disclosure, reproduction, or dissemination) by persons d> other than the intended recipient(s) is prohibited. If you receive d> this e-mail in error, please notify the sender by phone or email d> immediately and delete it! d> ***************************************************************************************** === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月08日 星期一 16:51
你开发出来的程序准备怎么用?有自己的服务器么?还是用服务商提供的虚拟主机服务?如果你可以自己选择使用什么技术,你可以不用cgi,因为cgi速度慢,消耗系统资源大。可以使用别的基于Python的Web开发技术,例如mod_python(非常的快),zope,CherryPy等等。 ------- Explicit is better than implicit ... -----Original Message----- From: d24471 [mailto:duyuming at huawei.com] Sent: 2004年3月8日 16:23 To: python-chinese at lists.python.cn Subject: [python-chinese] 如何让python脚本支持中文? 我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20040308/d82cdeb3/attachment.htm
2004年03月08日 星期一 17:01
Hello d24471, """ xml.parsers.expat.ExpatError: no element found: line 7, column 10 """ 看着象,通常的XML解析时的问题, 编码不对,致使断字出了问题! 加载 CJKCodecs http://cjkpython.berlios.de/ 声明一下子你的脚本编码试一试? === [ 16:42 ; 04-03-08 ] you wrote: d> 我在运行一个范例程序,是用cgi方式做的论坛,我试着输入中文的时候得到一些报错,如下: d> 范例可以从http://www.deitel.net/registration/registrationForm.asp?ultimateDestination=http://www.deitel.com/books/pythonHTP1/pythonHTP1_examples.zip下载是第16章的范例。 d> 这些报错把我搞迷糊了,不知道是那里的问题? d> ================================== d> [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] Premature d> end of script headers: default.py d> [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] Traceback (most recent call last): d> [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] File d> "D:/Apache Group/Apache2/cgi-bin/default.py", line 34, in ? d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] d> document = reader.fromStream( XMLFile ) d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\reader\PyExpat.py", d> line 65, in fromStream d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] d> success = self.parser.ParseFile(stream) d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] d> xml.parsers.expat.ExpatError: no element found: line 7, column 10 d> ----- Original Message ----- d> From: "Zoom.Quiet" <zoomq at infopro.cn> d> To: "d24471" <duyuming at huawei.com> d> Cc: <python-chinese at lists.python.cn> d> Sent: Monday, March 08, 2004 4:38 PM d> Subject: Re: [python-chinese] 如何让python脚本支持中文? >> Hello d24471, >> >> http://www.zqstudio.org:9085/Zoom_Quiet/Nucleus/index.php?itemid=132 >> 有一些, >> 不过.Apache 本身对于流通的编码没有要求, >> MySQL 更加不会挑剔! >> XML 根本与编码没有关系,只要声明一下子就好! >> 你的问题主要在哪里? >> >> === [ 16:23 ; 04-03-08 ] you wrote: >> >> d> >> 我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! >> d> >> *************************************************************************************** >> d> This e-mail and its attachments contain confidential >> d> information from HUAWEI, which is intended only for the person or >> d> entity whose address is listed above. Any use of the information >> d> contained herein in any way (including, but not limited to, total >> d> or partial disclosure, reproduction, or dissemination) by persons >> d> other than the intended recipient(s) is prohibited. If you receive >> d> this e-mail in error, please notify the sender by phone or email >> d> immediately and delete it! >> d> >> ***************************************************************************************** >> >> === === === === === === === === === === >> >> -- >> Best regards, >> Zoom.Quiet >> >> /=======================================\ >> ]Time is unimportant, only life important![ >> \=======================================/ >> === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月08日 星期一 17:18
你的意思是在default.py中加载cjkcodecs?那具体的语法是什么呢?在cjk的网页上没有看到使用说明,谢谢! ----- Original Message ----- From: "Zoom.Quiet" <zoomq at infopro.cn> To: "d24471" <duyuming at huawei.com> Cc: <python-chinese at lists.python.cn> Sent: Monday, March 08, 2004 5:01 PM Subject: Re[2]: [python-chinese] 如何让python脚本支持中文? > Hello d24471, > > """ > xml.parsers.expat.ExpatError: no element found: line 7, column 10 > """ > 看着象,通常的XML解析时的问题, > 编码不对,致使断字出了问题! > 加载 CJKCodecs > http://cjkpython.berlios.de/ > > 声明一下子你的脚本编码试一试? > > === [ 16:42 ; 04-03-08 ] you wrote: > > d> 我在运行一个范例程序,是用cgi方式做的论坛,我试着输入中文的时候得到一些报错,如下: > d> 范例可以从http://www.deitel.net/registration/registrationForm.asp?ultimateDestination=http://www.deitel.com/books/pythonHTP1/pythonHTP1_examples.zip下载是第16章的范例。 > d> 这些报错把我搞迷糊了,不知道是那里的问题? > d> ================================== > d> [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] Premature > d> end of script headers: default.py > d> [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] Traceback (most recent call last): > > d> [Mon Mar 08 15:59:11 2004] [error] [client 127.0.0.1] File > d> "D:/Apache Group/Apache2/cgi-bin/default.py", line 34, in ? > > d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] > d> document = reader.fromStream( XMLFile ) > > d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] File > d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\reader\PyExpat.py", > d> line 65, in fromStream > > d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] > d> success = self.parser.ParseFile(stream) > > d> [Mon Mar 08 15:59:12 2004] [error] [client 127.0.0.1] > d> xml.parsers.expat.ExpatError: no element found: line 7, column 10 > > d> ----- Original Message ----- > d> From: "Zoom.Quiet" <zoomq at infopro.cn> > d> To: "d24471" <duyuming at huawei.com> > d> Cc: <python-chinese at lists.python.cn> > d> Sent: Monday, March 08, 2004 4:38 PM > d> Subject: Re: [python-chinese] 如何让python脚本支持中文? > > > >> Hello d24471, > >> > >> http://www.zqstudio.org:9085/Zoom_Quiet/Nucleus/index.php?itemid=132 > >> 有一些, > >> 不过.Apache 本身对于流通的编码没有要求, > >> MySQL 更加不会挑剔! > >> XML 根本与编码没有关系,只要声明一下子就好! > >> 你的问题主要在哪里? > >> > >> === [ 16:23 ; 04-03-08 ] you wrote: > >> > >> d> > >> 我使用的python版本为2.3.2,目前打算利用apache+pyxml+mysql开发一些cgi脚本,希望系统可以支持用户使用中文,一直没有找到这方面的资料,不知道那位大侠有这方面的经验?谢谢! > >> d> > >> *************************************************************************************** > >> d> This e-mail and its attachments contain confidential > >> d> information from HUAWEI, which is intended only for the person or > >> d> entity whose address is listed above. Any use of the information > >> d> contained herein in any way (including, but not limited to, total > >> d> or partial disclosure, reproduction, or dissemination) by persons > >> d> other than the intended recipient(s) is prohibited. If you receive > >> d> this e-mail in error, please notify the sender by phone or email > >> d> immediately and delete it! > >> d> > >> ***************************************************************************************** > >> > >> === === === === === === === === === === > >> > >> -- > >> Best regards, > >> Zoom.Quiet > >> > >> /=======================================\ > >> ]Time is unimportant, only life important![ > >> \=======================================/ > >> > > === === === === === === === === === === > > -- > Best regards, > Zoom.Quiet > > /=======================================\ > ]Time is unimportant, only life important![ > \=======================================/ >
2004年03月08日 星期一 17:50
我试了一下,单纯加入import CJKCodecs语句没有任何改善,报错还是那样的。 而且很奇怪,同样的脚本前几天还可以运行的,今天不知道为什么突然就不行了。 我甚至重装了一遍python,但是效果总是一样的。 怀疑是apache会把访问的效果保持相当一段时间,因此不断重试总会得到一样的报错,当时间过后就恢复正常了。不知道是不是这样?在那里可以修改这些设置?刚才再运行的时候又可以了,但是再次输入中文,得到了更多的报错(我为每一个py脚本都增加了import CJKCodecs语句),看来是个系统问题啊,你能下载那个范例试试吗?谢谢! ======================= [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] Premature end of script headers: addForum.py, referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] Traceback (most recent call last): , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] File "D:/Apache Group/Apache2/cgi-bin/addForum.py", line 72, in ? , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] PrettyPrint( document, forumsFile ) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\__init__.py", line 81, in PrettyPrint , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] Printer.PrintWalker(visitor, root).run() , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:53 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 385, in run , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] return self.step() , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 381, in step , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] self.visitor.visit(self.start_node) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 185, in visit , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] return self.visitDocument(node) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 231, in visitDocument , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes, exclude=node.doctype) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 161, in visit , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] return self.visitElement(node) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 270, in visitElement , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 161, in visit , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] return self.visitElement(node) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 270, in visitElement , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 161, in visit , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] return self.visitElement(node) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:54 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 270, in visitElement , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 167, in visit , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] return self.visitText(node) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 293, in visitText , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] text = TranslateCdata(text, self.encoding) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 118, in TranslateCdata , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] new_string = charsetHandler(new_string, encoding) , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 44, in utf8_to_code , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] text = unicode(text, "utf-8") , referer: http://localhost/cgi-bin/addForum.py [Mon Mar 08 17:44:55 2004] [error] [client 127.0.0.1] UnicodeDecodeError: 'utf8' codec can't decode byte 0xb7 in position 0: unexpected code byte , referer: http://localhost/cgi-bin/addForum.py
2004年03月08日 星期一 19:48
我总算试出来是怎么回事了,那个论坛脚本很土,它不断对xml文件(论坛本身)进行重写和读取,以记录人员的操作结果。 这样一来,一旦操作中出现错误,就会破坏xml文件结构,引起PyExpat.py的执行错误。 不过引起错误的根源还是脚本本身不支持中文处理,大侠有空看看那个脚本吧,看怎么改一改让它可以处理中文?谢谢! 下面是因为中文而引起的报错: ============= [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] Premature end of script headers: addPost.py, referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] Traceback (most recent call last): , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] File "D:/Apache Group/Apache2/cgi-bin/addPost.py", line 83, in ? , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] PrettyPrint( document, forumFile ) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\__init__.py", line 81, in PrettyPrint , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] Printer.PrintWalker(visitor, root).run() , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 385, in run , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.step() , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 381, in step , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] self.visitor.visit(self.start_node) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 185, in visit , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitDocument(node) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 231, in visitDocument , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes, exclude=node.doctype) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 161, in visit , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitElement(node) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 270, in visitElement , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 161, in visit , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitElement(node) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 270, in visitElement , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 161, in visit , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] return self.visitElement(node) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 270, in visitElement , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] self.visitNodeList(node.childNodes) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 201, in visitNodeList , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] curr is not exclude and self.visit(curr) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 167, in visit , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] return self.visitText(node) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 293, in visitText , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] text = TranslateCdata(text, self.encoding) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 118, in TranslateCdata , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] new_string = charsetHandler(new_string, encoding) , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line 44, in utf8_to_code , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] text = unicode(text, "utf-8") , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] UnicodeDecodeError: 'utf8' codec can't decode byte 0xb7 in position 0: unexpected code byte , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml ============= 在这个基础上再修改论坛的逻辑,先写一个临时文件,判断是否合符要求,再退回或覆盖更新原有xml文件,这样就不会出错了,最多退回到没有操作时的情况。
2004年03月08日 星期一 23:16
Python 已经有 Codecs 函数,问题是不支持中文 encodings. 我最近下载了 CJKcodecs, Windows 和 Linux 两个都没问题。 不必使用 import CJKcodecs.py. 就要使用: chineseUnicodeTxt = unicode("中文","gb2312") # "gbk", "gb18030" chineseUTF8Txt = chineseUnicodeTxt.encode("utf8") gbTxt = chineseUnicodeTxt.encode("gb2312") # "gbk", "gb18030" > 你的意思是在default.py中加载cjkcodecs?那具体的语法是什么呢?在cjk的网 > 页上没有看到使用说明,谢谢! > > 看着象,通常的XML解析时的问题, > > 编码不对,致使断字出了问题! > > 加载 CJKCodecs > > http://cjkpython.berlios.de/ > > > > 声明一下子你的脚本编码试一试? > > > > > 我在运行一个范例程序,是用cgi方式做的论坛,我试着输入中文的时候得 > > > 到一些报错,如下: > > > 范例可以从
2004年03月08日 星期一 23:29
Hello d24471, 唉呀! 回到家里才看到你的回复! 不过你也真的很努力,这么快就可以深入到这个程度是也乎! 不过,不要虾来吓去的,大家都是爱好者,互通有无是也乎! 首先, CJKCodecs 不是import 来用的, Python 2.3.X 以后,脚本开始识别类似以下的: # -*- coding: iso-8859-1 -*- 脚本编码声明, 如果脚本本身含有中文什么的变量处理,应该进行声明…… 而你的问题来源,主要还是选择的程序本身在设计的时候并没有考虑到多语言编码和论坛的容错性,而且如你试验的log 可以看出,论坛没有使用数据库进行内容管理,而仅仅是单纯的XML文件进行管理,本身就是个试验性质的作品哪? 因为NXD产品也已经有了,但是都不成熟,XML本身也应该是作为交流的规范而不是数据仓库………… 简单的处理是找到类似编码的设置修改为: encoding = "mbcs" 因为Win32系统中,Python 对于中文是作为 mbcs 处理的, utf-8 则有更多的细节问题,不是简单的可以修改的, 不过也因此有了一些经验,重新选择一个比较完善的CGI 论坛进行学习,研究吧! 不要在错误的设计基础上进行自个儿的学习哪………… === [ 19:48 ; 04-03-08 ] you wrote: d> 我总算试出来是怎么回事了,那个论坛脚本很土,它不断对xml文件(论坛本身)进行重写和读取,以记录人员的操作结果。 d> 这样一来,一旦操作中出现错误,就会破坏xml文件结构,引起PyExpat.py的执行错误。 d> 不过引起错误的根源还是脚本本身不支持中文处理,大侠有空看看那个脚本吧,看怎么改一改让它可以处理中文?谢谢! d> 下面是因为中文而引起的报错: d> ============= d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] Premature d> end of script headers: addPost.py, referer: d> http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] Traceback (most recent call last): d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] File d> "D:/Apache Group/Apache2/cgi-bin/addPost.py", line 83, in ? d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] d> PrettyPrint( document, forumFile ) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\__init__.py", line d> 81, in PrettyPrint d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> Printer.PrintWalker(visitor, root).run() d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 385, in run d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.step() d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 381, in step d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitor.visit(self.start_node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 185, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitDocument(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 231, in visitDocument d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes, exclude=node.doctype) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 161, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitElement(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 270, in visitElement d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 161, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitElement(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 270, in visitElement d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 161, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] return self.visitElement(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 270, in visitElement d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 167, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] return self.visitText(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 293, in visitText d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] text d> = TranslateCdata(text, self.encoding) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 118, in TranslateCdata d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] d> new_string = charsetHandler(new_string, encoding) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 44, in utf8_to_code d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] text = unicode(text, "utf-8") d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] d> UnicodeDecodeError: 'utf8' codec can't decode byte 0xb7 in position d> 0: unexpected code byte d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> ============= d> 在这个基础上再修改论坛的逻辑,先写一个临时文件,判断是否合符要求,再退回或覆盖更新原有xml文件,这样就不会出错了,最多退回到没有操作时的情况。 === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月09日 星期二 09:37
那你那里有没有一个可以运行的支持中文的论坛代码呢?或者那里有下载呢?多谢! xml文件来存储论坛信息在论坛规模小的时候应该是没有问题的,而且为了显示的方便,通常都需要xml+xslt+css来实现多种显示要求,以及内容与显示的分离,而且xml的应用还可以屏蔽后端数据源变化对论坛的影响,应该是很合理的。不过不知道对系统性能有没有影响? 只是这个脚本没有考虑到容错,以及多语言化,实在很不应该,也难怪毕竟是教材的范例而已吧。 而且如果论坛规模小的的话,直接用xml文档记录应该是没有问题的了。
2004年03月09日 星期二 09:58
Hello d24471, XML+XSLT 的组合的确有非常多的优点, 可惜现在浏览器中装的 XML processor 各家都不一样,都不符合W3C的规范的, 如果你是为了学习XML 的Python 应用,得自个儿找一下了, 找到了,也一定告诉在下哪!因为,我正是进行XML 相关的企业门户软件开发, 不过,如果仅仅是你要进行论坛发布管理, 建议使用 Zope-Plone 真正的数据,逻辑,展示分开管理的CMS, 而且论坛的安装,升级非常简单, 现在有 CMFBoard ,CMFForum 等等成熟的论坛, 而且 Wiki Blog 等等其它形式的信息发布系统都有! zope.org 中文的论坛效果: http://www.czug.org/forums === [ 9:37 ; 04-03-09 ] you wrote: d> 那你那里有没有一个可以运行的支持中文的论坛代码呢?或者那里有下载呢?多谢! d> xml文件来存储论坛信息在论坛规模小的时候应该是没有问题的,而且为了显示的方便,通常都需要xml+xslt+css来实现多种显示要求,以及内容与显示的分离,而且xml的应用还可以屏蔽后端数据源变化对论坛的影响,应该是很合理的。不过不知道对系统性能有没有影响? d> 只是这个脚本没有考虑到容错,以及多语言化,实在很不应该,也难怪毕竟是教材的范例而已吧。 d> 而且如果论坛规模小的的话,直接用xml文档记录应该是没有问题的了。 === [ 19:48 ; 04-03-08 ] you wrote: d> 我总算试出来是怎么回事了,那个论坛脚本很土,它不断对xml文件(论坛本身)进行重写和读取,以记录人员的操作结果。 d> 这样一来,一旦操作中出现错误,就会破坏xml文件结构,引起PyExpat.py的执行错误。 d> 不过引起错误的根源还是脚本本身不支持中文处理,大侠有空看看那个脚本吧,看怎么改一改让它可以处理中文?谢谢! d> 下面是因为中文而引起的报错: d> ============= d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] Premature d> end of script headers: addPost.py, referer: d> http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] Traceback (most recent call last): d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] File d> "D:/Apache Group/Apache2/cgi-bin/addPost.py", line 83, in ? d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:54 2004] [error] [client 127.0.0.1] d> PrettyPrint( document, forumFile ) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\__init__.py", line d> 81, in PrettyPrint d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> Printer.PrintWalker(visitor, root).run() d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 385, in run d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.step() d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 381, in step d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitor.visit(self.start_node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 185, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitDocument(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 231, in visitDocument d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes, exclude=node.doctype) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 161, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitElement(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 270, in visitElement d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 161, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] return self.visitElement(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 270, in visitElement d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:55 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 161, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] return self.visitElement(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 270, in visitElement d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] d> self.visitNodeList(node.childNodes) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 201, in visitNodeList d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] curr d> is not exclude and self.visit(curr) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 167, in visit d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] return self.visitText(node) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 293, in visitText d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] text d> = TranslateCdata(text, self.encoding) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 118, in TranslateCdata d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] d> new_string = charsetHandler(new_string, encoding) d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] File d> "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\Printer.py", line d> 44, in utf8_to_code d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] text = unicode(text, "utf-8") d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> [Mon Mar 08 19:26:56 2004] [error] [client 127.0.0.1] d> UnicodeDecodeError: 'utf8' codec can't decode byte 0xb7 in position d> 0: unexpected code byte d> , referer: http://localhost/cgi-bin/addPost.py?file=pkg.xml d> ============= d> 在这个基础上再修改论坛的逻辑,先写一个临时文件,判断是否合符要求,再退回或覆盖更新原有xml文件,这样就不会出错了,最多退回到没有操作时的情况。 === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月09日 星期二 13:18
我想下载python for delphi及其文档 但我访问不了 谁能告诉我该怎么访问?
2004年03月14日 星期日 14:03
hi, 我今天又试了一下,把书中ch16的第一个范例cgi(fig16_02.py)所生成的xml文件(不是论坛,是一个把txt文件中的信息提取出来在网页上输出表格信息的脚本)打出来看了看,发现是编码方式不统一导致的问题. txt文件中的中文,脚本是可以接受的,但问题在于当写入到xml文件中的时候,由于编码不正确,导致xml文件格式被破坏,而且是特定的汉字会破坏xml文件结果,一般情况是会输出乱码. 不知道要如何操作来确定输入时的汉字采用的是何种编码?以及写入xml文件时又是什么编码? 需要说明的是如果你用ue来看脚本写的xml文件,一定要打开utf-8的支持否则看到的情况是没有任何问题的,一旦打开utf-8支持你就会发现,那些中文都是乱码了. 你有试过按utf-8的编码方式来想文件中写入中文吗?怎么操作的?可以提示一下吗? 另外,我设置了默认编码方式为utf-8 import sys sys.setdefaultencoding('UTF-8') =========================================================== cmd窗口输出如下: D:\Apache Group\Apache2\cgi-bin>python hz_xml.py Content-type: text/xml 雪波 刘 yuming 杜 Bob Red Mary ----------------- 最终的xml文件片断如下: ------------------------" µ ѩ²¨ " ¶ü/LastName> yuming " Red Bob ----- Original Message ----- From: "Zoom.Quiet" <zoomq at infopro.cn> To: "d24471" <duyuming at huawei.com> Cc: <python-chinese at lists.python.cn> Sent: Tuesday, March 09, 2004 9:58 AM Subject: Re[4]: [python-chinese] 如何让python脚本支持中文? > Hello d24471, > > XML+XSLT 的组合的确有非常多的优点, > 可惜现在浏览器中装的 XML processor 各家都不一样,都不符合W3C的规范的, > > 如果你是为了学习XML 的Python 应用,得自个儿找一下了, > 找到了,也一定告诉在下哪!因为,我正是进行XML 相关的企业门户软件开发, > > 不过,如果仅仅是你要进行论坛发布管理, > 建议使用 Zope-Plone > 真正的数据,逻辑,展示分开管理的CMS, > 而且论坛的安装,升级非常简单, > 现在有 CMFBoard ,CMFForum 等等成熟的论坛, > 而且 Wiki Blog 等等其它形式的信息发布系统都有! > zope.org > > 中文的论坛效果: > http://www.czug.org/forums > > === [ 9:37 ; 04-03-09 ] you wrote: > > d> 那你那里有没有一个可以运行的支持中文的论坛代码呢?或者那里有下载呢?多谢! > d> xml文件来存储论坛信息在论坛规模小的时候应该是没有问题的,而且为了显示的方便,通常都需要xml+xslt+css来实现多种显示要求,以及内容与显示的分离,而且xml的应用还可以屏蔽后端数据源变化对论坛的影响,应该是很合理的。不过不知道对系统性能有没有影响? > d> 只是这个脚本没有考虑到容错,以及多语言化,实在很不应该,也难怪毕竟是教材的范例而已吧。 > d> 而且如果论坛规模小的的话,直接用xml文档记录应该是没有问题的了。 > > > === [ 19:48 ; 04-03-08 ] you wrote: > > d> 我总算试出来是怎么回事了,那个论坛脚本很土,它不断对xml文件(论坛本身)进行重写和读取,以记录人员的操作结果。 > d> 这样一来,一旦操作中出现错误,就会破坏xml文件结构,引起PyExpat.py的执行错误。 > d> 不过引起错误的根源还是脚本本身不支持中文处理,大侠有空看看那个脚本吧,看怎么改一改让它可以处理中文?谢谢! > === === === === === === === === === === > > -- > Best regards, > Zoom.Quiet > > /=======================================\ > ]Time is unimportant, only life important![ > \=======================================/ >
2004年03月14日 星期日 14:26
Hello d24471, 嗯嗯! 真的很持着哪! 首先,Python相关的讨论在列表里发布吧! 在下真的仅仅是爱好者,需要所有人共同关注的! 另外,没有注意到 你一直提的书,是什么书哪? 我也看一下子,才能解答的是也乎! 而且 http://www.cnforyou.com/query/bookdetail.asp?viBookCode=5995 有专门的"XML与Perl、Python和PHP编程指南"比较实用,建议拿一本哪! ... 其实 cgi 脚本,基本上就是本地脚本程序,不过是由 web server 进行调用, 完全可以先,使用脚本的调试正法来测试的,不一定要直接在 Apache 中进行, 可以节省时间哪! 而且,XML 文本,也没有非要一定是 utf-8 的?! 我平时使用的xml 都有如下的声明: """ ... """ 因为主要是 IE 在 win32 下面进行引用! 而且,毕竟现在 utf-8 并没有成为中文编辑的流行编码! 所以,我一般是在进行处理时,进行转码,保存时,尽量使用 gb! === [ 14:03 ; 04-03-14 ] you wrote: d> hi, d> d> 我今天又试了一下,把书中ch16的第一个范例cgi(fig16_02.py)所生成的xml文件(不是论坛,是一个把txt文件中的信息提取出来在网页上输出表格信息的脚本)打出来看了看,发现是编码方式不统一导致的问题. d> d> txt文件中的中文,脚本是可以接受的,但问题在于当写入到xml文件中的时候,由于编码不正确,导致xml文件格式被破坏,而且是特定的汉字会破坏xml文件结果,一般情况是会输出乱码. d> d> 不知道要如何操作来确定输入时的汉字采用的是何种编码?以及写入xml文件时又是什么编码? d> d> 需要说明的是如果你用ue来看脚本写的xml文件,一定要打开utf-8的支持否则看到的情况是没有任何问题的,一旦打开utf-8支持你就会发现,那些中文都是乱码了. d> d> 你有试过按utf-8的编码方式来想文件中写入中文吗?怎么操作的?可以提示一下吗? d> 另外,我设置了默认编码方式为utf-8 d> import sys d> sys.setdefaultencoding('UTF-8') d> =========================================================== d> cmd窗口输出如下: d> D:\Apache Group\Apache2\cgi-bin>python hz_xml.py d> Content-type: text/xml d> 雪波 d> 刘 d> yuming d> 杜 d> Bob d> Red d> Mary d> ----------------- d> 最终的xml文件片断如下: d> ------------------------ d>" d> d>μ d>?2¨ d>" d> d>?ü/LastName> d> yuming d>" d> Red d>Bob d> ----- Original Message ----- d> From: "Zoom.Quiet" <zoomq at infopro.cn> d> To: "d24471" <duyuming at huawei.com> d> Cc: <python-chinese at lists.python.cn> d> Sent: Tuesday, March 09, 2004 9:58 AM d> Subject: Re[4]: [python-chinese] 如何让python脚本支持中文? >> Hello d24471, >> >> XML+XSLT 的组合的确有非常多的优点, >> 可惜现在浏览器中装的 XML processor >> 各家都不一样,都不符合W3C的规范的, >> >> 如果你是为了学习XML 的Python 应用,得自个儿找一下了, >> 找到了,也一定告诉在下哪!因为,我正是进行XML 相关的企业门户软件开发, >> >> 不过,如果仅仅是你要进行论坛发布管理, >> 建议使用 Zope-Plone >> 真正的数据,逻辑,展示分开管理的CMS, >> 而且论坛的安装,升级非常简单, >> 现在有 CMFBoard ,CMFForum 等等成熟的论坛, >> 而且 Wiki Blog 等等其它形式的信息发布系统都有! >> zope.org >> >> 中文的论坛效果: >> http://www.czug.org/forums >> >> === [ 9:37 ; 04-03-09 ] you wrote: >> >> d> >> 那你那里有没有一个可以运行的支持中文的论坛代码呢?或者那里有下载呢?多谢! >> d> >> xml文件来存储论坛信息在论坛规模小的时候应该是没有问题的,而且为了显示的方便,通常都需要xml+xslt+css来实现多种显示要求,以及内容与显示的分离,而且xml的应用还可以屏蔽后端数据源变化对论坛的影响,应该是很合理的。不过不知道对系统性能有没有影响? >> d> >> 只是这个脚本没有考虑到容错,以及多语言化,实在很不应该,也难怪毕竟是教材的范例而已吧。 >> d> 而且如果论坛规模小的的话,直接用xml文档记录应该是没有问题的了。 >> >> >> === [ 19:48 ; 04-03-08 ] you wrote: >> >> d> >> 我总算试出来是怎么回事了,那个论坛脚本很土,它不断对xml文件(论坛本身)进行重写和读取,以记录人员的操作结果。 >> d> >> 这样一来,一旦操作中出现错误,就会破坏xml文件结构,引起PyExpat.py的执行错误。 >> d> >> 不过引起错误的根源还是脚本本身不支持中文处理,大侠有空看看那个脚本吧,看怎么改一改让它可以处理中文?谢谢! >> === === === === === === === === === === >> >> -- >> Best regards, >> Zoom.Quiet >> >> /=======================================\ >> ]Time is unimportant, only life important![ >> \=======================================/ >> === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月14日 星期日 14:52
书的名称是清华大学出版社2003年6月出版的,原书是deitel出的,可以在网站www.deitel.com上下载相关的资料. 按你的说法,把编码方式全改为gb2312,就没有问题了,可以正确的写出xml文件.看来utf-8的确不太通用啊.多谢! >
2004年03月14日 星期日 15:00
Hello d24471, 咦咦咦!? 错! Unicode 是趋势哪!象 Zope 完全可以用 utf-8 进行一切信息的管理! 只是,现在相应的编辑软件没有默许支持,主要可能还是输入的问题? 而且,我们自个儿编的小软件,没有必要……嗬嗬嗬,没有精力是真 ^__^ 进行专门的编码处置,除非目标是进行开源软件发布,考虑全球用户的使用………… 查一下子 pyiconv 的资料? 有专门的项目,支持 Python 的多语言编码的! === [ 14:52 ; 04-03-14 ] you wrote: d> 书的名称是清华大学出版社2003年6月出版的,原书是deitel出的,可以在网站www.deitel.com上下载相关的资料. d> 按你的说法,把编码方式全改为gb2312,就没有问题了,可以正确的写出xml文件.看来utf-8的确不太通用啊.多谢! >> === === === === === === === === === === -- Best regards, Zoom.Quiet /=======================================\ ]Time is unimportant, only life important![ \=======================================/
2004年03月14日 星期日 15:37
目前试着将书中那个论坛的范例全部用gb2312做编码,还是会有报错, 看来问题完全解决还是有一段路啊。 再帮忙看看?多谢! [Sun Mar 14 15:30:10 2004] [error] [client 127.0.0.1] Premature end of script headers: default.py, referer: http://localhost/cgi-bin/addforum.py [Sun Mar 14 15:30:10 2004] [error] [client 127.0.0.1] Traceback (most recent call last): , referer: http://localhost/cgi-bin/addforum.py [Sun Mar 14 15:30:10 2004] [error] [client 127.0.0.1] File "D:/Apache Group/Apache2/cgi-bin/default.py", line 36, in ? , referer: http://localhost/cgi-bin/addforum.py [Sun Mar 14 15:30:10 2004] [error] [client 127.0.0.1] document = reader.fromStream( XMLFile ) , referer: http://localhost/cgi-bin/addforum.py [Sun Mar 14 15:30:11 2004] [error] [client 127.0.0.1] File "D:\Python23\Lib\site-packages\_xmlplus\dom\ext\reader\PyExpat.py", line 65, in fromStream , referer: http://localhost/cgi-bin/addforum.py [Sun Mar 14 15:30:11 2004] [error] [client 127.0.0.1] success = self.parser.ParseFile(stream) , referer: http://localhost/cgi-bin/addforum.py [Sun Mar 14 15:30:11 2004] [error] [client 127.0.0.1] xml.parsers.expat.ExpatError: unknown encoding: line 1, column 30 , referer: http://localhost/cgi-bin/addforum.py ----- Original Message ----- From: "Zoom.Quiet" <zoomq at infopro.cn> To: "d24471" <duyuming at huawei.com> Cc: <python-chinese at lists.python.cn> Sent: Sunday, March 14, 2004 3:00 PM Subject: Re[8]: [python-chinese] 如何让python脚本支持中文? > Hello d24471, > > 咦咦咦!? > 错! > Unicode 是趋势哪!象 Zope 完全可以用 utf-8 进行一切信息的管理! > > 只是,现在相应的编辑软件没有默许支持,主要可能还是输入的问题? > > 而且,我们自个儿编的小软件,没有必要……嗬嗬嗬,没有精力是真 ^__^ > 进行专门的编码处置,除非目标是进行开源软件发布,考虑全球用户的使用………… > > 查一下子 pyiconv 的资料? > 有专门的项目,支持 Python 的多语言编码的! > > === [ 14:52 ; 04-03-14 ] you wrote: > > d> 书的名称是清华大学出版社2003年6月出版的,原书是deitel出的,可以在网站www.deitel.com上下载相关的资料. > d> 按你的说法,把编码方式全改为gb2312,就没有问题了,可以正确的写出xml文件.看来utf-8的确不太通用啊.多谢! > >> > > === === === === === === === === === === > > -- > Best regards, > Zoom.Quiet > > /=======================================\ > ]Time is unimportant, only life important![ > \=======================================/ >
Zeuux © 2024
京ICP备05028076号