Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] UTF-8 support and compliant components




Yes, since we found that System.out is mangling the text it makes sense (if
you give it some thought) that you have to run the test program using the
proper encoding setting.
I'm guessing the reason you have to set the system property for the outer
Eclipse is that the console is testing the file.encoding property and not
the Eclipse setting. Otherwise it should be sufficient to change the
Workbench/Editors encoding setting. Can someone from the debug team comment
on this?
I wonder if we should have a more global encoding setting. Currently it
wouldn't even be intuitive to change the Workbench/Editors encoding
setting.

On my machine all glyphs are displayed properly, including the Chinese
ones. I use the default system font (Tahoma) for the console. I don't think
Eclipse or SWT can or should fall back on some other font if the currently
set font does not have all glyphs needed to render a particular string. I
don't know how Mozilla does this but it sounds slow.
Can you confirm that you see the correct glyphs if you select "Use System
Font" in the Workbench/Fonts preferences for the debug console.

Knut


|---------+---------------------------------->
|         |           Andre John Mas         |
|         |           <ajmas@xxxxxxxxxxxxxxxx|
|         |           >                      |
|         |           Sent by:               |
|         |           platform-swt-dev-admin@|
|         |           eclipse.org            |
|         |                                  |
|         |                                  |
|         |           04/25/2003 02:37 PM    |
|         |           Please respond to      |
|         |           platform-swt-dev       |
|         |                                  |
|---------+---------------------------------->
  >------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                              |
  |       To:       platform-swt-dev@xxxxxxxxxxx                                                                                 |
  |       cc:                                                                                                                    |
  |       Subject:  Re: [platform-swt-dev] UTF-8 support and compliant components                                                |
  |                                                                                                                              |
  >------------------------------------------------------------------------------------------------------------------------------|




If forgot something obvious, setting the -D option on the VM of
the subprocess too. This gets me the following:

    123-g5Ξ㈯冓

So it works. Though while the copy and paste shows all the characters
correctly the last two were represented as boxes in the console,
indicative that the font used in the console probably does not
include the Chinese glyphs.

I wonder whether it would be possible to use the same sort of logic
used in the Java API, and also Mozilla, to look in another font for
the missing glyphs - or maybe this is something that the system should
be handling?

A further test show that if you don't set the file encoding used by
Eclipse to UTF-8, while setting that of the client process, you get
the following (mangled data):

    123-g5Ξ㈯冓

Also, you must set the file encoding used by the child VM as a parameter
to the VM, doing a System.setProperty() is too late, since the
output stream has already been initialised.

Andre

Andre John Mas wrote:
> On your suggestion I tried that passing the following parameters:
>
>    -vmargs -Dfile.encoding=UTF-8
>
> based on the docs at:
>
>   http://dev.eclipse.org/help21/index.jsp?topic=
>     /org.eclipse.platform.doc.user/tasks/running_eclipse.htm
>
> but that does not work either. I see that the file encoding is
> is set to UTF-8 in the 'About Eclipse' window, but this doesn't
> seem to be affecting the output.
>
> Andre
>
> Knut Radloff wrote:
>
>> The console is using the StyledText widget, I verified that StyledText
>> displays the characters correctly when using the same font set in the
>> Console.
>> This doesn't appear to be font related anyway. When I run the same
>> println outside Eclipse, on the command line it also does not print
>> correctly. It looks like something gets messed up on the way through
>> System.out.println. What is the file.encoding VM/system property set
>> to? This is displayed as the default text file encoding on the
>> Workbench/Editors preference page.
>> You could try running Eclipse with the vm argument -Dfile.encoding=UTF-8
>>
>> Knut
>>
>>
>>
>>
>> Andre John Mas <ajmas@xxxxxxxxxxxxxxxx>
>> Sent by: platform-swt-dev-admin@xxxxxxxxxxx
>> 04/24/2003 04:08 PM
>> Please respond to platform-swt-dev
>>
>>
>>         To:     platform-swt-dev@xxxxxxxxxxx
>>         cc:     Steve_Northover@xxxxxxxxxx
>>         Subject:        Re: [platform-swt-dev] UTF-8 support and
>> compliant components
>>
>>
>>
>> The font I use is 'Courier New'. I have just looked at the preferences
>> under 'Workbench -> Fonts' and I see the the 'Debug Console Text Font'
>> is indeed Courier New. Using Notepad, Wordpad and Character Map I see
>> that the font is capable of displaying these glyphs.
>>
>> I have installed all the possible language settings in Control Panel
>> -> Regional Options.
>>
>> Maybe having someone try a similar test on MacOS X, which I know is also
>> a unicode compliant platform may give some insight.
>>
>> regards
>>
>> Andre
>>
>> Steve Northover wrote:
>>
>>> Can you enter these characters into Word or Wordpad?  If the font
>>
>>
>> doesn't
>>
>>> have the unicode glyphs, it can't draw the characters.  Try this code.
>>> It appears that the font used by the Eclipse console doesn't have
\u039e
>>> but the default font for the text widget does.  Not sure about the
rest.
>>>
>>> *public* *static* *void* main (String [] args) {
>>>        Display display = *new* Display ();
>>>        Shell shell = *new* Shell (display);
>>>        Text text = *new* Text (shell, SWT.SINGLE | SWT.BORDER);
>>>        text.setText ( "123-\u0067\u0035\u039e\u322F\u5193" );
>>>        System.out.println ( "123-\u0067\u0035\u039e\u322F\u5193" );
>>>        text.pack ();
>>>        shell.pack ();
>>>        shell.open ();
>>>        *while* (!shell.isDisposed ()) {
>>>                *if* (!display.readAndDispatch ()) display.sleep ();
>>>        }
>>>        display.dispose ();
>>> }
>>>
>>>
>>>
>>> *Andre John Mas <ajmas@xxxxxxxxxxxxxxxx>*
>>> Sent by: platform-swt-dev-admin@xxxxxxxxxxx
>>>
>>> Andre John Mas wrote:
>>> > Is there a chart anywhere indicating which components are UTF-8
>>> compliant?
>>> >
>>>
>>> I forgot to mention that I am asking the question because the
>>> following code:
>>>
>>>  System.out.println("123-\u0067\u0035\u039e\u322F\u5193");
>>>
>>> when run in Eclipse 2.1 gives me, under Windows 2000:
>>>
>>>  123-g5???
>>>
>>> instead of the expected characters (display will depend on your OS
>>> and mail client):
>>>
>>>  123-g5Ξ㈯冓
>>>
>>> I am not sure whether this issue is because of the implementation
>>> of the SWT component underlying the  Console in Eclipse, because
>>> of the way Eclipse is implemented or due to the JDK configuration
>>> that I am using.
>>>
>>> Any help would be very much appreciated.
>>>
>>> Thanks
>>>
>>> Andre
>>
>>
>>
>> _______________________________________________
>> platform-swt-dev mailing list
>> platform-swt-dev@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev
>>
>>
>>
>> ?V?~??]z?X??X???Z??+??-u??rX???+?m???z?*lz???f??f??X??)ߣ?ej??k0?ׯ
>
>
>


--
André-John Mas
Software Developer / Développeur Informatique
Newtrade Technologies Inc.
63 de Brésoles, Suite 100, Montreal, Quebec, Canada H2Y 1V7
mailto:ajmas@xxxxxxxxxxxx
tel +1 514 286-8180 x3017
fax +1 514 221-3287

----------------------------------------------------------------------
If you have received this message in error, please notify the sender
immediately and delete the original without making a copy, disclosing
its contents or taking any action based thereon.

Si vous avez reçu ce message par erreur, veuillez en aviser
immédiatement le signataire et effacer l'original, sans en tirer de
copie, en dévoiler le contenu ni prendre quelque mesure fondée sur
celui-ci.


_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top