[Tutor] Japanese and COM

Ryan Ginstrom ryang at gol.com
Fri Mar 17 08:55:18 CET 2006


I'm (still) having trouble using Japanese in python.

I want to use Japanese with the win32com module. But while I can retrieve
Japanese text from a COM server without problems, if I try to send Japanese
text to a COM server it comes out garbled.

Here is an example:

#-*- coding: utf-8 -*-
import win32com.client

o = win32com.client.Dispatch("Excel.Application")
o.Visible = 1
o.Workbooks.Add()
o.Cells(1,1).Value = "日本語"

#------------

The Japanese text sent to Excel is garbled. Yet I can retrieve Japanese text
from Excel or other COM servers, and it's fine. Is there something simple (I
hope) that I'm doing wrong?

Regards,
Ryan

---
Ryan Ginstrom
ryang at gol.com
http://ginstrom.com 



More information about the Tutor mailing list