subprocess decoding?

M

MC

Hi!

On win-XP (french), when I read subprocess (stdout), I must use
differents decoding (cp1252,cp850,cp437, or no decoding), depending of
the "launch mode" of the same Python's script:
- from command-line
- from start+run
- from icon
- by Python-COM-server
- etc.

(.py & .pyw can also contribute)


How to know, on the fly, the encoding used by subprocess?


Thanks by advance
 
L

Leo Kislov

MC said:
Hi!

On win-XP (french), when I read subprocess (stdout), I must use
differents decoding (cp1252,cp850,cp437, or no decoding), depending of
the "launch mode" of the same Python's script:
- from command-line
- from start+run
- from icon
- by Python-COM-server
- etc.

(.py & .pyw can also contribute)


How to know, on the fly, the encoding used by subprocess?

You can't. Consider a Windows equivalent of UNIX "cat" program. It just
dump content of a file to stdout. So the problem of finding out the
encoding of stdout is equal to finding out encoding of any file. It's
just impossible to do in general. Now, you maybe talking about
conventions. AFAIK since Windows doesn't have strong command line
culture, it doesn't such conventions.

-- Leo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top