Issue1783897
Created on 2007-08-29.09:57:31 by david-perez, last changed 2007-09-03.06:34:21 by david-perez.
File name |
Uploaded |
Description |
Edit |
Remove |
Py.java.patch
|
david-perez,
2007-08-29.09:57:31
|
|
|
|
msg2858 (view) |
Author: David Pérez (david-perez) |
Date: 2007-08-29.09:57:31 |
|
With this patch, the default source encoding of files can be easily customizable, through the use of standard java properties.
For example:
java -jar jython.jar -Djython.default.source.encoding=UTF-8 myfile.py
UTF-8 encoding can be in this way used, which is handy, as it supports any language in the world.
|
msg2859 (view) |
Author: Charlie Groves (cgroves) |
Date: 2007-08-31.08:09:21 |
|
I'm pretty hesitant to add a system property to specify something in Jython that has a corresponding mechanism in Python. We'll be adding source file encodings per PEP 263 in the next version of Jython. I realize this has the advantage that it makes all files UTF-8 or whatever encoding you choose by default, but that's balanced in my mind by the fact that code written like that won't work with CPython out of the box. Does this patch have anything else to recommend it over PEP 263?
|
msg2860 (view) |
Author: David Pérez (david-perez) |
Date: 2007-08-31.10:07:36 |
|
It's an optional mechanism, in addition to PEP 263, to specify the default encoding, if one isn't present in the own file.
Some users like me, don't mind if it doesn't run in CPython when using this optional switch, as our Python code has already a lot of calls to Java code.
I think this patch isn't harmful (only active if you define the property), is useful and quite simple.
Java itself has also a property for specifying the default encoding used for Readers and Writers.
|
msg2861 (view) |
Author: Charlie Groves (cgroves) |
Date: 2007-08-31.15:18:13 |
|
One of my favorite features of Python is that there's generally one obvious way to do things. Having two features that are equivalent in effect but slightly different in usage leads to a dual burden. There's the obvious burden of the maintainer in having more code in the codebase, more bugs to fix and a more complicated program to work on. The thing I'm more worried about is a new user trying to decide how to get started with Jython. Every decision they have to make adds friction to the experience keeping them from getting up to speed. For this they'd have to learn about both the system property, and PEP 263 encoding systems and evaluate them side by side before moving forward. So, while this patch isn't 'harmful', the weight of it and 100 other things like it can lead to harm.
|
msg2862 (view) |
Author: David Pérez (david-perez) |
Date: 2007-09-03.06:34:21 |
|
Thanks for explaining so detailed your philosophy.
|
|
Date |
User |
Action |
Args |
2007-08-29 09:57:31 | david-perez | create | |
|