aspose file tools*
The moose likes Java in General and the fly likes how to convert special character registered trademark ® to  number code & # 174; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to convert special character registered trademark ® to  number code & # 174; " Watch "how to convert special character registered trademark ® to  number code & # 174; " New topic
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
you mean like this?

javax.swing.JOptionPane.showMessageDialog(null, "\u00ae");
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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: 19541
    
  16

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 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to convert special character registered trademark ® to number code & # 174;
 
Similar Threads
Yet another bump in the programming road..
reg split method in string
Charset and special characters
How to converst a String to unicode
Escape HTML