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



[Posting via Google's web interface again and hoping that double
newlines will prevent insane concatenation of lines...]


prats wrote:


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?


Actually, it contains the original text in the ISO-2022-JP encoding and
not a unicode representation. You're just storing an anonymous sequence
of characters in your encoded_string variable which you then return.
Any
user interface element that receives these later on has to guess which
encoding is used to represent the text, and it sounds like it can't do
that.


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


If you're using the text in the GUI, you shouldn't need to pass it
through the codec at all. It should be possible to display the original
string in any widget that can display text. Keep the text in a QString
and
it should just work.


David

.



Relevant Pages

  • Re: WideCharToMultiByte returns default character when input language for non-Unicode programs s
    ... I have support for Japanese installed on my machine. ... WideCharToMultiByte to translate a Unicode string to Multibyte and ... if I set the language for non-Unicode programs to English ... by examining the numerical value of the characters in the text string? ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Need help with CABWIZ
    ... I thought your previous posting said that CAB files couldn't contain multibyte glyphs. ... CABWIZ isn't the only defective component of the Japanese version of Visual Studio 2005, it's just the part that I needed help with in this thread. ... If we're going to argue about belittling, then revisit your own statement "having Unicode doesn't simply give you Japanese glyph support". ... a limitation on the way that CABWIZ stores it's data - it's single byte characters, so there's no way it can store a multi-byte glyph. ...
    (microsoft.public.pocketpc.developer)
  • Re: Japanese strings get mangled when sent from VB6 to VC++ dll
    ... Japanese characters, as I only noticed two of the rectangles and none of the ... In the second string, the first three characters are wrong. ... The first character comes up a rectangle, ...
    (microsoft.public.vb.general.discussion)
  • [sljfaq] Japanese lettering page added
    ... In the same way that there are various ways of writing English, ... Japanese has many different ways of being ... traditional square style of characters, with horizontal lines slanting upwards going from left to right. ...
    (sci.lang.japan)
  • Re: Quest for the book detectives...
    ... I was too run-down with a cold to see my Japanese language mentor today ... Chinese, not Japanese. ... Note that the characters chose 'power' 'warrior' is masculine in its ... Who "Felix" might be is a complete mystery, ...
    (rec.collecting.books)