Skip to main content
added 31 characters in body
Source Link
Cody Gray
  • 64.5k
  • 23
  • 197
  • 313

Text of the answer:

does sys.getdefaultencoding() returning the 'right' value ?Full Text of the answer:

then you can try this

does sys.getdefaultencoding() returning the 'right' value ?

then you can try this

reader = codecs.getreader(sys.getdefaultencoding()) 
reader = codecs.getreader(sys.getdefaultencoding()) 
sys.stdin = reader(sys.stdin)

but ...

maybe it is not a good idea

but ...


 

maybe it is not a good idea

Text of the comments:Text of the comments:


Sounds like a dirty hack ;-) ...I tried it and interestingly, sys.getdefaultencoding() does return the "right" value in PyDev/Jython. Unfortunately, this didn't have any influence on the value of sys.stdin.encoding. I am suspecting the python-gnupg code to use that to communicate with the binary... anyway, doesn't your hack also means that the encoding is not stored with the stream/reader objects??? – Christian Gelinek Mar 13 at 11:27

Sounds like a dirty hack ;-) ...I tried it and interestingly, sys.getdefaultencoding() does return the "right" value in PyDev/Jython. Unfortunately, this didn't have any influence on the value of sys.stdin.encoding. I am suspecting the python-gnupg code to use that to communicate with the binary... anyway, doesn't your hack also means that the encoding is not stored with the stream/reader objects???
Christian Gelinek Mar 13 at 11:27

I meant to say: Since changing the sys.stdin reference to a manually created reader object with its encoding configured doesn't change the sys.stdin's encoding (which I assume to be the reader object's), then the encoding doesn't seem to be "remembered" by your reader. Or did I miss something? – Christian Gelinek Mar 13 at 11:38

I meant to say: Since changing the sys.stdin reference to a manually created reader object with its encoding configured doesn't change the sys.stdin's encoding (which I assume to be the reader object's), then the encoding doesn't seem to be "remembered" by your reader. Or did I miss something?
Christian Gelinek Mar 13 at 11:38

PyDev creates special sys.stdin and sys.stdout objects for Eclipse console window? – Mikko Ohtamaa Mar 14 at 4:58

PyDev creates special sys.stdin and sys.stdout objects for Eclipse console window?
Mikko Ohtamaa Mar 14 at 4:58

I guess so, how otherwise would it get the output into it's Console window and let the user type into that window for input purposes? I'm not sure though if the problem is indeed related to those objects, because I think python-gnupg tries to find out about the encoding for communicating with the gpg executable. – Christian Gelinek Mar 14 at 7:04

I guess so, how otherwise would it get the output into it's Console window and let the user type into that window for input purposes? I'm not sure though if the problem is indeed related to those objects, because I think python-gnupg tries to find out about the encoding for communicating with the gpg executable.
Christian Gelinek Mar 14 at 7:04

ok, ok this wasn't helpfull, .. but deleting it will kill the comments ? / starting a bounty – Blauohr Mar 14 at 8:23

ok, ok this wasn't helpfull, .. but deleting it will kill the comments ? / starting a bounty
Blauohr Mar 14 at 8:23

Text of the answer:

does sys.getdefaultencoding() returning the 'right' value ?

then you can try this

reader = codecs.getreader(sys.getdefaultencoding()) 
sys.stdin = reader(sys.stdin)

but ...

maybe it is not a good idea


 

Text of the comments:


Sounds like a dirty hack ;-) ...I tried it and interestingly, sys.getdefaultencoding() does return the "right" value in PyDev/Jython. Unfortunately, this didn't have any influence on the value of sys.stdin.encoding. I am suspecting the python-gnupg code to use that to communicate with the binary... anyway, doesn't your hack also means that the encoding is not stored with the stream/reader objects??? – Christian Gelinek Mar 13 at 11:27

I meant to say: Since changing the sys.stdin reference to a manually created reader object with its encoding configured doesn't change the sys.stdin's encoding (which I assume to be the reader object's), then the encoding doesn't seem to be "remembered" by your reader. Or did I miss something? – Christian Gelinek Mar 13 at 11:38

PyDev creates special sys.stdin and sys.stdout objects for Eclipse console window? – Mikko Ohtamaa Mar 14 at 4:58

I guess so, how otherwise would it get the output into it's Console window and let the user type into that window for input purposes? I'm not sure though if the problem is indeed related to those objects, because I think python-gnupg tries to find out about the encoding for communicating with the gpg executable. – Christian Gelinek Mar 14 at 7:04

ok, ok this wasn't helpfull, .. but deleting it will kill the comments ? / starting a bounty – Blauohr Mar 14 at 8:23

Full Text of the answer:

does sys.getdefaultencoding() returning the 'right' value ?

then you can try this

reader = codecs.getreader(sys.getdefaultencoding()) 
sys.stdin = reader(sys.stdin)

but ...

maybe it is not a good idea

Text of the comments:

Sounds like a dirty hack ;-) ...I tried it and interestingly, sys.getdefaultencoding() does return the "right" value in PyDev/Jython. Unfortunately, this didn't have any influence on the value of sys.stdin.encoding. I am suspecting the python-gnupg code to use that to communicate with the binary... anyway, doesn't your hack also means that the encoding is not stored with the stream/reader objects???
Christian Gelinek Mar 13 at 11:27

I meant to say: Since changing the sys.stdin reference to a manually created reader object with its encoding configured doesn't change the sys.stdin's encoding (which I assume to be the reader object's), then the encoding doesn't seem to be "remembered" by your reader. Or did I miss something?
Christian Gelinek Mar 13 at 11:38

PyDev creates special sys.stdin and sys.stdout objects for Eclipse console window?
Mikko Ohtamaa Mar 14 at 4:58

I guess so, how otherwise would it get the output into it's Console window and let the user type into that window for input purposes? I'm not sure though if the problem is indeed related to those objects, because I think python-gnupg tries to find out about the encoding for communicating with the gpg executable.
Christian Gelinek Mar 14 at 7:04

ok, ok this wasn't helpfull, .. but deleting it will kill the comments ? / starting a bounty
Blauohr Mar 14 at 8:23

Source Link
Shadow Wizard
  • 175k
  • 33
  • 437
  • 864

That answer was deleted indeed by its author - nothing you can or should do to prevent it, it's his full right.

However, for the exact purpose of preserving information 10K+ members (in addition to moderators of course) can still see it all.

So, here it is: (click for full size image)

deleted answer screenshot

Text of the answer:


does sys.getdefaultencoding() returning the 'right' value ?

then you can try this

reader = codecs.getreader(sys.getdefaultencoding()) 
sys.stdin = reader(sys.stdin)

but ...

maybe it is not a good idea


Text of the comments:


Sounds like a dirty hack ;-) ...I tried it and interestingly, sys.getdefaultencoding() does return the "right" value in PyDev/Jython. Unfortunately, this didn't have any influence on the value of sys.stdin.encoding. I am suspecting the python-gnupg code to use that to communicate with the binary... anyway, doesn't your hack also means that the encoding is not stored with the stream/reader objects??? – Christian Gelinek Mar 13 at 11:27

I meant to say: Since changing the sys.stdin reference to a manually created reader object with its encoding configured doesn't change the sys.stdin's encoding (which I assume to be the reader object's), then the encoding doesn't seem to be "remembered" by your reader. Or did I miss something? – Christian Gelinek Mar 13 at 11:38

PyDev creates special sys.stdin and sys.stdout objects for Eclipse console window? – Mikko Ohtamaa Mar 14 at 4:58

I guess so, how otherwise would it get the output into it's Console window and let the user type into that window for input purposes? I'm not sure though if the problem is indeed related to those objects, because I think python-gnupg tries to find out about the encoding for communicating with the gpg executable. – Christian Gelinek Mar 14 at 7:04

ok, ok this wasn't helpfull, .. but deleting it will kill the comments ? / starting a bounty – Blauohr Mar 14 at 8:23