Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #3473 > unrolled thread

UTF-8 in Swing app on Win

Started by"Hendrik Maryns" <hendrik.maryns@THRWHITE.remove-dii-this>
First post2011-04-27 15:45 +0000
Last post2011-04-27 15:45 +0000
Articles 4 — 2 participants

Back to article view | Back to comp.lang.java.gui


Contents

  UTF-8 in Swing app on Win "Hendrik Maryns" <hendrik.maryns@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
    Re: UTF-8 in Swing app on "Hendrik Maryns" <hendrik.maryns@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
      Re: UTF-8 in Swing app on "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000
    Re: UTF-8 in Swing app on "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:45 +0000

#3473 — UTF-8 in Swing app on Win

From"Hendrik Maryns" <hendrik.maryns@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectUTF-8 in Swing app on Win
Message-ID<fvs4r0$d5$1@newsserv.zdv.uni-tuebingen.de>
  To: comp.lang.java.gui
Hi,

I have a Swing application which runs fine on Linux, showing some UTF-8 
symbols outside of the usual range fine.  However, on Win2000, these 
show up as the usual strange symbols.  So obviously, the strings are 
interpreted as cp1252.

How can I set it to use the proper symbols?

This only happens with the native look and feel, if I choose the default 
cross-platform one, the menuAs show up fine.

However, there is some text I read in and display as well, which gets 
garbled all the same.  How to fix this?

Thanks, H.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#3475 — Re: UTF-8 in Swing app on

From"Hendrik Maryns" <hendrik.maryns@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: UTF-8 in Swing app on
Message-ID<fvs5ti$2rr$1@newsserv.zdv.uni-tuebingen.de>
In reply to#3473
  To: comp.lang.java.gui
Hendrik Maryns wrote:
> Hi,
> 
> I have a Swing application which runs fine on Linux, showing some UTF-8 
> symbols outside of the usual range fine.  However, on Win2000, these 
> show up as the usual strange symbols.  So obviously, the strings are 
> interpreted as cp1252.
> 
> How can I set it to use the proper symbols?
> 
> This only happens with the native look and feel, if I choose the default 
> cross-platform one, the menuAs show up fine.
> 
> However, there is some text I read in and display as well, which gets 
> garbled all the same.  How to fix this?

Hm, seems to work now, strangely, although the only thing I changed was 
a fix to my second question:

final BufferedReader queriesF = new BufferedReader(new 
InputStreamReader(new FileInputStream(selectedFile), "UTF-8"));

instead of

final BufferedReader queriesF = new BufferedReader(new 
FileReader(selectedFile)));

Ah well, H.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3477 — Re: UTF-8 in Swing app on

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: UTF-8 in Swing app on
Message-ID<svc32491g0487t1dhqcb5o770u2hq8s146@4ax.com>
In reply to#3475
  To: comp.lang.java.gui
On Wed, 07 May 2008 14:05:16 +0200, Hendrik Maryns
<gtw37bn02@sneakemail.com> wrote, quoted or indirectly quoted someone
who said :

>
>final BufferedReader queriesF = new BufferedReader(new 
>FileReader(selectedFile)));

Use Wassup to find out what the default encoding is, or use the
Encoding applet.

See http://mindprod.com/applet/wassup.html
http://mindprod.com/jgloss/encoding.html

Any time you are flipping files between platforms, you are had better
pick an explicit encoding, usually UTF-8, or use binary.

-- 

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#3478 — Re: UTF-8 in Swing app on

From"Roedy Green" <roedy.green@THRWHITE.remove-dii-this>
Date2011-04-27 15:45 +0000
SubjectRe: UTF-8 in Swing app on
Message-ID<33d3245q831hf9hh0oapopub1ca07b87da@4ax.com>
In reply to#3473
  To: comp.lang.java.gui
On Wed, 07 May 2008 13:46:49 +0200, Hendrik Maryns
<gtw37bn02@sneakemail.com> wrote, quoted or indirectly quoted someone
who said :

>I have a Swing application which runs fine on Linux, showing some UTF-8 
>symbols outside of the usual range fine.  However, on Win2000, these 
>show up as the usual strange symbols.  So obviously, the strings are 
>interpreted as cp1252.

grab the char and dump it out in decimal. You may have the wrong
character, or you may have problems rendering the correct character.

Use http://mindprod.com/applet/fontshower.html
to help track down problems.
-- 

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web