[issue11597] Can't get ConfigParser.write to write unicode strings

2016-02-01 Thread neo gurb
neo gurb added the comment: In file ConfigParser.py, def write, replace line key = " = ".join((key, str(value).replace('\n', '\n\t'))) by key = " = ".join((key, str(value).decode('utf-8').replace('\n', '\n\t'))) Tested in Windows7 and Ubuntu 15.04. -- nosy: +neo gurb ___

[issue11597] Can't get ConfigParser.write to write unicode strings

2013-04-25 Thread Eugene Klimov
Eugene Klimov added the comment: some workaround import configparser import codecs cfg = configparser.ConfigParser() cfg.write(codecs.open('filename','wb+','utf-8')) -- nosy: +Eugene.Klimov ___ Python tracker ___

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-30 Thread the_isz
the_isz added the comment: Thanks for the hint, Łukasz, but like I stated earlier, I already worked around this problem by using the json module instead. -- ___ Python tracker _

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-30 Thread Łukasz Langa
Łukasz Langa added the comment: the_isz, for serious Unicode support you might try using the configparser 3.2 backport: http://pypi.python.org/pypi/configparser -- ___ Python tracker

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-06 Thread STINNER Victor
STINNER Victor added the comment: > Anyway, try to use Python everywhere in Python 2 is a waste of time. Oh... I mean "use Unicode in Python 2" -- ___ Python tracker ___ __

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-06 Thread STINNER Victor
STINNER Victor added the comment: > I think it is more a question of "is this an easy fix?" > or would it require extensive changes to support unicode properly. First of all, the question is: who would like to develop it. You can vote for an issue, but it doesn't change anything if you don't

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-06 Thread Łukasz Langa
Łukasz Langa added the comment: As another core dev aptly said, most standard library Unicode support is probably accidental. As for `json`, this is one of the "newest" additions to stdlib, introduced in Python 2.6 (released at the same time as Python 3.0). Not the best example if you compare

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-05 Thread the_isz
the_isz added the comment: Well, the only thing I can add to this is that the json module (which I ended up using) supports unicode with no problem. So I think the argument that most of the standard library in 2.x assumes bytestrings is a bit... shaky. Other than that, I can follow your reasoni

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-05 Thread R. David Murray
R. David Murray added the comment: No, the need for an encoding parameter for read/write makes it unambiguous that it is indeed a feature. -- resolution: -> wont fix status: open -> closed ___ Python tracker ___

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-04-05 Thread Łukasz Langa
Łukasz Langa added the comment: In my opinion we should unfortunately close this with WONTFIX because: * adding a feature in a point release is not an option * this may be poorly documented but most of the standard library in 2.x assumes bytestrings (and fails with Unicode strings). Same goes

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread Georg Brandl
Georg Brandl added the comment: My vote would be that this is a new feature and therefore uneligible for 2.x. -- nosy: +georg.brandl ___ Python tracker ___ _

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread R. David Murray
R. David Murray added the comment: I understand what you are saying, and I thought about that, too; but you could say the same thing about any bug fix that makes code work that didn't work before, yet we don't. So I guess you are right that it should be discussed on python-dev. --

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: It's also a question of adding a feature to a point release. If dev's relied on the new feature, they would also have to test for version > 2.7.1. We usually try to avoid that (after a minor fiasco with booleans many years ago). -- _

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread R. David Murray
R. David Murray added the comment: Well, python3 is probably pushing some people to try to add better unicode support to their python2 versions. I think it is more a question of "is this an easy fix?" or would it require extensive changes to support unicode properly. If it is easy (ie: it i

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread Raymond Hettinger
Raymond Hettinger added the comment: > Now the question is, is this a bug > or would adding support be a feature? That may be a good question for python-dev. Since ConfigParser is a very old module, if there were a pressing need, we probably would have heard about it before now. -- n

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread R. David Murray
R. David Murray added the comment: >>> str(u"\u0411") Traceback (most recent call last): File "", line 1, in UnicodeEncodeError: 'ascii' codec can't encode character u'\u0411' in position 0: ordinal not in range(128) So, clearly configparser in 2.x doesn't support unicode. Now the question

[issue11597] Can't get ConfigParser.write to write unicode strings

2011-03-18 Thread the_isz
New submission from the_isz : Hey everyone, I'm having issues writing unicode strings with ConfigParser.write. I don't know if this is python's fault or my own but I couldn't find help on this, neither by googling, nor by asking on the python irc channels. Attached to this description I'll add