[Kde-java] Compressed Icons in Java Apps created with juic

Richard Dale Richard_Dale at tipitina.demon.co.uk
Fri Aug 20 09:48:23 CEST 2004


On Friday 20 August 2004 07:24, Marco Ladermann wrote:
> Am Donnerstag, 19. August 2004 21:51 schrieb Richard Dale:
> > Yes, UTF-8 is the native format of strings in .ui files
>
> What does that mean? If I look in the output generated by uic, I can see
> that some strings are coded as hex and feed to "trUtf8" and others are not
> coded (probably pure ASCII string?) and only "tr" is used. Are there some
> rules, which I can use for the Java generation? Java strings are capable of
> holding utf-8 characters (sizeof(char)=16) without further translation.
> What does the JNI code with the Java strings? (Okay, I could look by my
> self, but ...)
I assume the strings in the java sources are expected to be utf-8, but at 
runtime they hold 16 bit chars.

From QtSupport.cpp, QtSupport::toQString() it does this:

 _jchar_str = env->GetStringChars(str, 0);

 if (_bigEndianUnicode) {
  (*qstring)->setUnicode((QChar *) _jchar_str, env->GetStringLength(str));
 } else {
  (*qstring)->setUnicodeCodes((const ushort *) _jchar_str, 
env->GetStringLength(str));
 }

So it just takes the java string and assumes it's 16 bit unicode. 

I've attached the .ui file I used for testing the ruby rbuic utility. It 
contains some Russian and Hebrew (right to left) text from the 
qt-copy/examples/fonts/simple-qfont-demo example.

-- Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testutf8.ui
Type: application/x-designer
Size: 973 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-java/attachments/20040820/e72f9dae/testutf8.bin


More information about the Kde-java mailing list