rlayhacker / torchat

Automatically exported from code.google.com/p/torchat
0 stars 0 forks source link

Torchat uses str.encode("ascii", "replace") #109

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If isinstance(s, str), s.encode("ascii", "replace") is equivalent to 
s.decode(sys.getdefaultencoding()).encode("ascii", "replace").
Since sys.getdefaultencoding() usually returns 'ascii', this fails when s 
contains non-ascii bytes.

Just call torchat in portable mode with a profile name like 'teßt':
> python torchat.py teßt
(0) [config,423,main] python version 2.7.2 (default, Oct  9 2011, 21:44:45) 
[GCC 4.5.3]
(0) [config,426,main] running in portable mode, all data is kept inside the bin 
folder.
(0) Traceback (most recent call last):
(0)   File "torchat.py", line 19, in <module>
(0) import config
(0)   File "/tmp/torchat-0.9.9.534/src/config.py", line 442, in <module>
(0) main()
(0)   File "/tmp/torchat-0.9.9.534/src/config.py", line 428, in main
(0) print "(0) ignoring requested profile '%s' because profiles do not exist in 
portable mode" % sys.argv[1]
(0)   File "/tmp/torchat-0.9.9.534/src/config.py", line 402, in write
(0) self.stdout.write(text.encode("ascii", "replace"))
(0) UnicodeDecodeError
(0) :
(0) 'ascii' codec can't decode byte 0xc3 in position 52: ordinal not in 
range(128)

Original issue reported on code.google.com by Domo.Sok...@gmail.com on 7 Nov 2011 at 10:18

GoogleCodeExporter commented 8 years ago
please test with rew release 0.9.9.550

Original comment by prof7...@gmail.com on 11 Nov 2011 at 2:42

GoogleCodeExporter commented 8 years ago

Original comment by prof7...@gmail.com on 11 Nov 2011 at 2:43