aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Showing special characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Showing special characters" Watch "Showing special characters" New topic
Author

Showing special characters

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Ok on the server side if I print the result of my query, the little special symbols (^tm and the little circle with an "R" in it, and the copyright symbol) show up.

But when I get the result with AJAX and put it in a div, the "special symbols" are replaced by boxes.

Is there a way I can fix this?

Thanks,

Justin Fox
[ January 27, 2008: Message edited by: Bear Bibeault ]

You down with OOP? Yeah you know me!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

You should be using HTML entities for the special symbols. ™ for ™ and ® for ®.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Ok, but the thing is, the text is stored in a database on the server, I'm just doing a select statement and returning the recordset in an echo format and then retrieving that echo with AJAX. how do I convert the boxes to what they need to be If all they are when they get to the xmlHttp.responseText are boxes.

Justin Fox
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

Your best bet is to perform a text substitution on the server before sending the text off as the response.
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
Thats what I was kind of thinking.

maybe like //trade and //reg and //copy

for the different symbols

Justin Fox
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

?
Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
good "?", because that didnt work.

I tried to replace all the '™' with //trade, and '®' with //reg and so on.

but it doesn't work.

so I'm pretty much lost...

Justin Fox
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61209
    
  66

After reading the string from the DB just perform a string replacement swapping the special chars (you'll need to lookup or figure out their values) with the HTML entities. I'm not sure what left field //trade came out of.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Showing special characters