text encodings -> subprocess.Popen or -> labelmarkup (pygtk)

C

calmar

Hi all,

first of all, I have to say I have hardly no knowledge about that
issue.

on the program there, I have it like that:


,-------------------------------------------------------
| obj = unicode(newcomment, 'utf-8')
| newcomment = obj.encode('latin-1')
|
| pipe = subprocess.Popen(tot, stdout=subprocess.PIPE,\
| stderr=subprocess.PIPE, shell=False)
`---

that seems to work with that construction above.

Then I think, 'what' kind of encoding I can send to an external program,
depends also on that program? Or on the environment? If, then how could
I get that environemnt? (the programs runs also under MS windows)

Well, maybe someone has some hints about encodings issues like that, and
what I can send to external commands?

thanks a lot
calmar



--
calmar

(o_ It rocks: LINUX + Command-Line-Interface
//\
V_/_ http://www.calmar.ws
 
F

Fredrik Lundh

calmar said:
Then I think, 'what' kind of encoding I can send to an external program,
depends also on that program?

the encoding is a mapping between raw bytes and their actual meaning,
and a program usually only sees the bytes, so it's entirely up to the pro-
gram to interpret what you send to it.

many programs defaults to the system's "global" default encoding for text
input; you can use the "getpreferredencoding" function in the locale module
to figure out what it is set to:

http://docs.python.org/lib/module-locale.html

</F>
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top