From: <cl...@br...> - 2009-08-24 20:35:44
|
Dear Jim, Thanks for clarification. I understand that clearly, its not really a bug but its about compliancy with the level of the Python 2.6 language standards. Indeed having UTF-8 support in Jython is welcome as the applications needs to adhere to the global requirements. "Oui, c'ést ça!". I´ve added a number of new statements which solved part of the problem: . A header line was added to all source files at 1st. line. The file was saved under JEdit tool with UTF-8 encoding. Its contents is : # -*- coding utf-8 -*- . For console print functions, in case of concatenation with Strings of unknown origin, like a DB, I´ve added the following conversion statement: print "title: " + mystring.encoding('ascii') . I´ve added the /opt/jython/Lib folder to my CLASSPATH system variable Even after adding those source updates, I still get a number of error messages which are somehow difficult to isolate, as they do not point a given source line, but throws a "run-time" exception like this: no codec search functions registered: can't find encoding Any hint how to correct (or avoid) those conversion errors or improve the syntax checking? Thanks in advance for your support. Regards, Cllaude Claude Falbriard Developer AMS Hortolândia / SP - Brazil phone: +55 13 9762 4094 cell: +55 13 8117 3316 e-mail: cl...@br... Jim Baker <jb...@zy...> 21/08/2009 18:35 To cl...@br... cc jyt...@li... Subject Re: [Jython-users] UTF-8 encoding issue with Jython source As the exception notes, we follow the relevant Python standard re source encoding (http://www.python.org/dev/peps/pep-0263/): Python will default to ASCII as standard encoding if no other encoding hints are given. There are unit tests in Python to test for compliance specifically about this, and we pass them. Implementing a property to change the default as a transition strategy is an interesting idea. You might want to submit a RFE for this to bugs.jython.org. There was a transition plan in PEP 263, however, because we skipped to 2.5, it was not seen in Jython. I think the easiest approach would be to add the source encoding marker to each included source file. This could be automated through a simple script. You may be able to use a 3rd party module like chardet to help here. - Jim On Fri, Aug 21, 2009 at 2:41 PM, <cl...@br...> wrote: Dear colleagues, I´ve got error messages on several Jython source files under Linux. Those files have been created under Windows using default encoding UTF-8 and have been transferred via ftp in a binary mode to a Suse LINUX system. The Jython installed is latest Version 2.5.0 from the official download site. Previous Jython like 2.2 did not throw such type of errors and already used UTF-8. To my understanding, this is default encoding for Jython. Error thrown: claudef@cobd:/opt/projectzero/workspace/ERCmail/jython> jython xxxx.py File "<string>", line None SyntaxError: Non-ASCII character in file 'xxxx.py', but no encoding declared; see http://www.python.org/peps/pep-0263.html for details Any idea if there is a utility available to detect the characters, to correct and clean them? Maybe there is a Jython setup option for weaker validation and auto-clean? Thanks in advance for your feedback. Regards, Claude Claude Falbriard Developer AMS Hortolândia / SP - Brazil phone: +55 13 9762 4094 cell: +55 13 8117 3316 e-mail: cl...@br... ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users -- Jim Baker jb...@zy... ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jython-users mailing list Jyt...@li... https://lists.sourceforge.net/lists/listinfo/jython-users |