• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Display character for HTML Number

 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not really saying what the problem is.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be no space character in the entity.
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This works fine for me




Eric
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Displaying it like above works for me as well. But I have to read it from the struts action form:

 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic