• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Showing special characters

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be using HTML entities for the special symbols. ™ for ™ and ® for ®.
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your best bet is to perform a text substitution on the server before sending the text off as the response.
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
?
 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65122
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic