A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
EJB 3 in Action
this week in the
EJB and other Java EE Technologies
Java in General
how to convert special character registered trademark ® to number code & # 174;
Joined: Dec 22, 2002
Jun 25, 2010 22:52:16
I need to convert special character ® to number code 174;
is there any
API method which can do convert?
Joined: Jun 09, 2003
Jun 26, 2010 01:31:20
you mean like this?
Joined: Sep 29, 2008
Jun 26, 2010 06:34:55
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.)
Joined: Oct 27, 2005
Jun 26, 2010 07:04:25
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:
subject: how to convert special character registered trademark ® to number code & # 174;
Yet another bump in the programming road..
reg split method in string
Charset and special characters
How to converst a String to unicode
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014