[PyQt] Display of Japanese Characters on Mac

Ullrich Martini mailbox at ullrich.martini.name
Fri Dec 17 18:50:21 GMT 2010


Hello,
here are more datails.

I use MacOS 10.6.5, I assume that this is valid for any recent Mac. I assume further that this here does not apply to a non-Mac computer.

Enable Japanese Input:
- Start System Settings
- Under Personal Settings there is a blue flag. Click that
- A new Window opens with the Title "Language & Text"
- Select the tab input sources
- Scroll down to "kotoeri"
- Select Kotoeri, then Hiragana (you may select more languages and input methods, but Hiragana is all I need here)

see http://redcocoon.org/cab/mysoft.html

I assume that other languages have the same issue. Therefore, I would recommend to redo this with other non-latin languages.

Entering Japanese text
Start the test Program (I attached it again)
In the top bar of the screen, next to the clock,  you should see a flag (British, USA, German, whatever the default of your Mac is). Click that flag.
Click Hiragana. The flag should change to a white-on-black curly symbol あ, the Japanese "a". If your email Program supports utf-8 correctly, you should be able to see it here
(now you can't enter any non-japanese text, on particular you can't type the name of the test program in a shell)
Select the window
Press 'k' (any consonant would do here) An underlined k should appear
Press 'a'  --> Wrong behavior: underlined k disappears; --> Correct behavior: k turns into か, the japanese syllable 'ka'

If you see the k disappear you have reproduced the issue.

Displaying japanese stuff
In my case the second attached program shows something garbled for the string "日本" (japanese for Japan), although I had used an utf-16 editor and had made sure it's actually saved it as utf-16. Of course the utf-16 coding might get lost during email transport. 
I delete the garbled stuff with backspace and get the warning "QTextCursor::setPosition: Position '7' out of range"

I  have used some japanese characters in this mail, (1) because this clarifies things and (2) to let you or Phil see if your computers can handle japanese characters at all. I assume that if you don't see them here correctly there is no point in trying to reproduce the issue. 

best regards
Ullrich

Am 17.12.2010 um 17:58 schrieb Hans-Peter Jansen:

> On Friday 17 December 2010, 10:11:26 Ullrich Martini wrote:
>> Hello,
>> this sample also doesn't display japanese. Same syndrome as I
>> described before. best regards,
>> Ullrich
> 
> Then I've no idea, what could be the difference to Qt here.
> 
> You might need to produce a step by step guidance, that Phil is able to 
> reproduce without knowing anything about japanese characters (are those 
> called cards?), e.g. 
> * how to switch the input method back and force
> * what keys have to be pressed on a us/uk keyboard
> * what card/character is to be expected/what's wrong
> in order to reproduce the discrepancy of Qt/PyQt. 
> 
> I'm sure, that Phil will look into it sooner or later..
> 
> Pete

#!/usr/bin/env python
from PyQt4 import QtGui
app = QtGui.QApplication([])
win = QtGui.QTextEdit()
win.show()
app.exec_()

#!/usr/bin/env python
# -*- coding: utf-16 -*-
from PyQt4 import QtGui
app = QtGui.QApplication([])
win = QtGui.QTextEdit("日本")
win.show()
app.exec_()




More information about the PyQt mailing list