"Kent Johnson" wrote in message
news:1c2a2c590905050337j1afc177ene64f800dcc3a7...@mail.gmail.com...
On Tue, May 5, 2009 at 1:14 AM, Mark Tolonen
wrote:
> The below works. ConfigParser isn't written to support Unicode
> correctly. I
> was able to get Unicode sections to write out, but it wa
On Tue, May 5, 2009 at 1:14 AM, Mark Tolonen wrote:
> The below works. ConfigParser isn't written to support Unicode correctly. I
> was able to get Unicode sections to write out, but it was just luck. Unicode
> keys and values break as the OP discovered. So treat everything as byte
> strings:
"spir" wrote in message
news:20090501220601.31891...@o...
Le Fri, 1 May 2009 15:19:29 -0300,
"Pablo P. F. de Faria" s'exprima ainsi:
self.cfg.write(codecs.open(self.properties_file,'w','utf-8'))
As one can see, the character encoding is explicitly UTF-8. But
ConfigParser keeps trying to sa
On Mon, May 4, 2009 at 3:54 PM, Sander Sweers wrote:
> 2009/5/4 Kent Johnson :
>> str.decode() converts a string to a unicode object. unicode.encode()
>> converts a unicode object to a (byte) string. Both of these functions
>> take the encoding as a parameter. When Python is given a string, but
>>
2009/5/4 Kent Johnson :
> str.decode() converts a string to a unicode object. unicode.encode()
> converts a unicode object to a (byte) string. Both of these functions
> take the encoding as a parameter. When Python is given a string, but
> it needs a unicode object, or vice-versa, it will encode or
Le Mon, 4 May 2009 11:09:25 -0300,
"Pablo P. F. de Faria" s'exprima ainsi:
> Thanks, Kent, but that doesn't solve my problem. In fact, I need
> ConfigParser to work with non-ascii characters, since my App may run
> in "latin-1" environments (folders e files names). I must find out why
> the str()
On Mon, May 4, 2009 at 1:32 PM, Pablo P. F. de Faria
wrote:
> Hi, all.
>
> I've found something that worked for me, but I'm not sure of its
> secureness. The solution is:
>
> reload(sys)
> sys.setdefaultencoding('utf-8')
>
> That's exactly what I wanted to do, but is this good practice?
No. You s
On Mon, May 4, 2009 at 10:09 AM, Pablo P. F. de Faria
wrote:
> Thanks, Kent, but that doesn't solve my problem. In fact, I need
> ConfigParser to work with non-ascii characters, since my App may run
> in "latin-1" environments (folders e files names).
Yes, I understand that.
Python has two diffe
Here is the traceback, after the last change you sugested:
Traceback (most recent call last):
File "/home/pablo/workspace/E-Dictor/src/MainFrame.py", line 1057, in OnClose
self.SavePreferences()
File "/home/pablo/workspace/E-Dictor/src/MainFrame.py", line 1069,
in SavePreferences
self.
Thanks, Kent, but that doesn't solve my problem. In fact, I need
ConfigParser to work with non-ascii characters, since my App may run
in "latin-1" environments (folders e files names). I must find out why
the str() function in the module ConfigParser doesn't use the encoding
defined for the applica
On Fri, May 1, 2009 at 4:54 PM, Pablo P. F. de Faria
wrote:
> Hi, Kent.
>
> The stack trace is:
>
> Traceback (most recent call last):
> File "/home/pablo/workspace/E-Dictor/src/MainFrame.py", line 1057, in OnClose
> self.SavePreferences()
> File "/home/pablo/workspace/E-Dictor/src/MainFrame.
Le Fri, 1 May 2009 15:19:29 -0300,
"Pablo P. F. de Faria" s'exprima ainsi:
> self.cfg.write(codecs.open(self.properties_file,'w','utf-8'))
>
> As one can see, the character encoding is explicitly UTF-8. But
> ConfigParser keeps trying to save it as a 'ascii' file and gives me
> error for directo
On Fri, May 1, 2009 at 2:19 PM, Pablo P. F. de Faria
wrote:
> Hi, all. I need some help.
>
> I'm trying to save a configuration file, using ConfigParser. The code
> is the following:
>
> self.cfg.write(codecs.open(self.properties_file,'w','utf-8'))
>
> As one can see, the character encoding is exp
Hi, all. I need some help.
I'm trying to save a configuration file, using ConfigParser. The code
is the following:
self.cfg.write(codecs.open(self.properties_file,'w','utf-8'))
As one can see, the character encoding is explicitly UTF-8. But
ConfigParser keeps trying to save it as a 'ascii' file
14 matches
Mail list logo