This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Display character for HTML Number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Display character for HTML Number" Watch "Display character for HTML Number" New topic
Author

Display character for HTML Number

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

Guys,

I have a textfield in which I show some text that I get from the server. For example., the server sends abcdefgh&# 286; and the character &# 286; stands for Ğ (Capital G-brave). I cannot use Javascript to do the decoding. Is there a way in the html text property that does this conversion autamatically for me?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

You're not really saying what the problem is.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

I guess I have written that in my post above. Here it is again. I want to convert the HTML number format &# 345; to its original character when it is displayed in the username field on my page. Right now, the username comes from the server as joth&# 345; and I want to somehow show the original character for the &# 345, but it gets displayed as joth&# 345;
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

There should be no space character in the entity.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

Bear Bibeault wrote:There should be no space character in the entity.


Yes, there is no space characeter in my application. I have explicitly left space here otherwise I guess instead of displaying &# 345; it displays it as ř (you see... without space this is what is happeneing)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
Why is it necessary to do the conversion? If you put that string on an HTML page, then the correct character should be displayed; are you saying it is not?


Ping & DNS - my free Android networking tools app
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

Ulf Dittmer wrote:Why is it necessary to do the conversion? If you put that string on an HTML page, then the correct character should be displayed; are you saying it is not?


Yes, it is not. I'm trying to display it in the html input field and also in the html password field but it still shows up as &# 345; and not in its original character.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
This works fine for me




Eric
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

Displaying it like above works for me as well. But I have to read it from the struts action form:

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Joe Harry wrote:Displaying it like above works for me as well. But I have to read it from the struts action form:



When it is rendered to the page it is a textbox. Makes no difference how it got to the page.

Are you setting an encoding?

Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Bear Bibeault wrote:
Joe Harry wrote:
Bear Bibeault wrote:There should be no space character in the entity.


Yes, there is no space characeter in my application. I have explicitly left space here otherwise I guess instead of displaying &# 345; it displays it as ř (you see... without space this is what is happeneing)


Please read AvoidRedHerrings. Next time, let us know when you are doing stuff like that. Otherwise, you waste your own and everyone else's time.

And since you know about HTML entities, why do you not just use HTML entities to make your posts appear correctly?


No one ever told him how to do it. Nice if it was documented somewhere on the ranch to use &192; to properly display it.

Eric
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9344
    
    2

Eric Pascarello wrote:
Bear Bibeault wrote:
Joe Harry wrote:
Bear Bibeault wrote:There should be no space character in the entity.


Yes, there is no space characeter in my application. I have explicitly left space here otherwise I guess instead of displaying &# 345; it displays it as ř (you see... without space this is what is happeneing)


Please read AvoidRedHerrings. Next time, let us know when you are doing stuff like that. Otherwise, you waste your own and everyone else's time.

And since you know about HTML entities, why do you not just use HTML entities to make your posts appear correctly?


No one ever told him how to do it. Nice if it was documented somewhere on the ranch to use &192; to properly display it.

Eric


Thanks. I did not knew how to get that character to display correctlyas it is.
 
wood burning stoves
 
subject: Display character for HTML Number
 
Similar Threads
Displaying Extended Unicode charsets in Html TEXTAREA
NumberFormat does not show right currency symbol
Internationalization in was5.0
Unusual characters written as ? in mssql server
oracle character set problem