help wanted regarding displaying Japanese characters in a GUI using QT and python

2006-04-19 Thread prats
I want to write a GUI application in PYTHON using QT. This application
is supposed to take in Japanese characters. I am using PyQt as the
wrapper for using QT from python. I am able to take input in japanese.
But I am unable to display them back to GUI. It displays some junk
characters Can anyone suggest me some way how to debug the issue.

The code used for tranferring data from view to document is:

"
codec = QTextCodec.codecForName('ISO-2022-JP')
encoded_string = codec.fromUnicode( string )
return str(encoded_string)
"

here string is QString object containing the data from the view.
I think the encoded_string is a QCString object and contains the
unicode coded characters of the japanese string given in the GUI?

how am I going to display the data back to the view from document.

I would be really grateful if somebody helps me in this regard.

Regards,
Pratik

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help wanted regarding displaying Japanese characters in a GUI using QT and python

2006-04-19 Thread prats
No I need to replace the text given by the user in the GUI by a new
text already in ISO-2022-JP encoding. Then I would have to redisplay
this new text. I explain in detail. I have a text file(say) which has
something written in it using base64 encoding and using charset
ISO-2022-JP. I want to display this data in the GUI.
What I did was first to read in the text and then decode it using
'decodestring' function of base64 module in python.
"
import base64
decoded_string = base64.decodestring(encoded_string)
"
here the encoded string is the text that was read from the file.

How do I display this decoded_string to the GUI?

~pratik

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help wanted regarding displaying Japanese characters in a GUI using QT and python

2006-04-20 Thread prats
I think I could not make myself clear. I have a GUI written in Python
and Qt and PyQt as the python wrappper fro QT. Now I have a string
which is base64 encoded. This string contains both japanese and english
charaters. I need to decode them and display them properly in the GUI
ie. with both english and japanese characters.
I need a way to display them. Qt doc says that QStrings are capable of
displaying all characters. So I need a way to get a QString from the
base64 encoded string.
~pratik

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help wanted regarding displaying Japanese characters in a GUI using QT and python

2006-04-20 Thread prats
sorry I did not correctly read your point. I works fine. Thanks for
your help.
I have one more query. It was said that the text I was supposed to show
was written using "ISO-2022-JP" charset. But It didn't when I decoded
it using that charset. But it worked fine with the "shift-jis"
encoding. Is it the default charset used by python i.e. I mean to say
bytes would be by default "shift-jis"? 
~pratik

-- 
http://mail.python.org/mailman/listinfo/python-list