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


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

JTextField Unicode Mysq

Started by"Badshah" <badshah@THRWHITE.remove-dii-this>
First post2011-04-27 15:29 +0000
Last post2011-04-27 15:29 +0000
Articles 2 — 2 participants

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


Contents

  JTextField  Unicode  Mysq "Badshah" <badshah@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000
    Re: JTextField  Unicode "mikey" <mikey@THRWHITE.remove-dii-this> - 2011-04-27 15:29 +0000

#796 — JTextField Unicode Mysq

From"Badshah" <badshah@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectJTextField Unicode Mysq
Message-ID<1169814706.283669.75990@v45g2000cwv.googlegroups.com>
  To: comp.lang.java.gui
Hello Friends, How are you ? I am Sohil. I am here with a problem

I am creating a text editor that will store data in mySql database. I
want to get the data in text field. I am having "♥" character in
database.

Select * from bank_master;
+---------+-----------+
| Bank_Id | Bank_Name |
+---------+-----------+
|       3 | ♥         |
+---------+-----------+

I am not able to display this character in textbox. The text box is
showing a rectangle  instead of that character.

     textfield.setText(rs.getString("Bank_Name"));

But, when I am retriving the character from text box and display it on
the command prompt console it shows right character ie. "♥"

     System.out.println(textfield.getText());

I am not able to get the problem here.

Sohil Surti

---
 * 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]


#811 — Re: JTextField Unicode

From"mikey" <mikey@THRWHITE.remove-dii-this>
Date2011-04-27 15:29 +0000
SubjectRe: JTextField Unicode
Message-ID<45bc435b$0$735$5fc3050@dreader2.news.tiscali.nl>
In reply to#796
  To: comp.lang.java.gui
Hi Sohil,

your problem is that what you have in the database is a bitpattern that 
can be interpreted differently. The interpretation of a bitpattern as a 
string of characters is called 'encoding'. What you are seeing here is 
that the DOS box uses an encoding with a name/number I can't remember 
right now while the textfield probably uses an encoding named 'UTF8'.

'UTF8' is far superior to the encoding used by DOS if you plan on any 
internationalization (google for UNICODE). So you should stick with that 
  and think about where the data in the DB came from. You'll probably 
have to do some conversion.


Cheers



> Hello Friends, How are you ? I am Sohil. I am here with a problem
> 
> I am creating a text editor that will store data in mySql database. I
> want to get the data in text field. I am having "rON" character in
> database.
> 
> Select * from bank_master;
> +---------+-----------+
> | Bank_Id | Bank_Name |
> +---------+-----------+
> |       3 | rON         |
> +---------+-----------+
> 
> I am not able to display this character in textbox. The text box is
> showing a rectangle  instead of that character.
> 
>      textfield.setText(rs.getString("Bank_Name"));
> 
> But, when I am retriving the character from text box and display it on
> the command prompt console it shows right character ie. "rON"
> 
>      System.out.println(textfield.getText());
> 
> I am not able to get the problem here.
> 
> Sohil Surti
>

---
 * 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