Interpreting Unicode scripts

  • Thread starter Keith MacDonald
  • Start date
K

Keith MacDonald

Hello,

I am considering embedding Python in a C++ application, which works
internally in UTF-16. The only API I can find for running scripts is
PyRun_SimpleString(const char*). Does that mean that Python is unable to
execute scripts containing characters from more than one code page?

Thanks,
Keith MacDonald
 
F

Fredrik Lundh

Keith said:
I am considering embedding Python in a C++ application, which works
internally in UTF-16. The only API I can find for running scripts is
PyRun_SimpleString(const char*). Does that mean that Python is unable to
execute scripts containing characters from more than one code page?

reading PEP 263 might help:

http://www.python.org/peps/pep-0263.html

(summary: encode as utf-8, prepend "# coding: utf-8\n", and you're done)

</F>
 
K

Keith MacDonald

That document did help, thanks, although I was initially disconcerted to see
that it's written in the future tense. Anyway, it works with Python 2.4.

Keith MacDonald
 

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