| Author |
how to convert special character registered trademark ® to number code & # 174;
|
chaohua wang
Ranch Hand
Joined: Dec 22, 2002
Posts: 62
|
|
Hi Folks,
I need to convert special character ® to number code 174;
http://www.webmonkey.com/2010/02/special_characters/
is there any java API method which can do convert?
Thank you
Chwang
|
 |
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
|
posted

0
|
you mean like this?
javax.swing.JOptionPane.showMessageDialog(null, "\u00ae");
|
 |
David Newton
Author
Rancher
Joined: Sep 29, 2008
Posts: 12617
|
posted

0
|
Or an HTML escaping utility, but I don't know if it would escape it to a named entity or the number. Apache Commons Lang has such utilities.
(And no, I don't think displaying it in an option pane is really converting it to an entity.)
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19214
|
|
|
The 174 is the int representation of the character; 00ae is hexadecimal for 174. So just cast your char into an int, then wrap it in &# and ;
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: how to convert special character registered trademark ® to number code & # 174;
|
|
|