JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 26th, 2001, 01:30 PM
viccard viccard is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: Ottawa, Ontario
Posts: 50 viccard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Lightbulb Bad JavaScript bug with special characters

Hi,

As I found that JavaScript is not capable to render numbered entities for special characters in any DHTML code. So, all codes like &_#_245_; ('õ' without uderscores) are displayed as numbers when used in form elements.

Simple example:

var test = "ó";
alert(test); - shows code
document.write(test); - shows character

Does anyone know a way to render character code as a character in alert() function or form elements?

Thanks,
Vic

Reply With Quote
  #2  
Old August 26th, 2001, 04:10 PM
evildj evildj is offline
Beelzebub
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Location: The nether regions...ok, San Diego
Posts: 164 evildj User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 12
Yeah, that kind of stuff can be confusing. The alert box uses escape codes, and the write method uses html character entities. Try alert(unescape(test))

Sorry...I didn't test that enough. I'll keep trying.

Last edited by evildj : August 26th, 2001 at 04:21 PM.

Reply With Quote
  #3  
Old August 29th, 2001, 11:55 PM
pieux pieux is offline
Señor Member
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2000
Posts: 1,157 pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 h 23 m 35 sec
Reputation Power: 36
Are you sure it's not just that the font/typeface used in form elements is one that doesn't have what you are expecting for that ASCII equivalent? Try setting your typeface in the rest of your page to Arial and see if the character looks the same, then also try Courier and Courier New. I do know that those kinds of symbols vary from typeface to typeface (and the particular one used in the forms may just not have that entity at all).
__________________
Michael

Reply With Quote
  #4  
Old August 30th, 2001, 05:27 AM
dang65 dang65 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: Wilmslow, Cheshire
Posts: 255 dang65 User rank is Corporal (100 - 500 Reputation Level)dang65 User rank is Corporal (100 - 500 Reputation Level)dang65 User rank is Corporal (100 - 500 Reputation Level)dang65 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 m 57 sec
Reputation Power: 17
This one's cropped up before and one slightly obscure way around it is to place the special character into a hidden form field and then alert the value of the field. The alert then displays the character rather than the code. Tried using 'unescape()' as above but that didn't work. Try adapting this:

<SCRIPT LANGUAGE=javascript>
<!--
var str = "õ";

document.write('<FORM ID="Dave" NAME="Dave">')
document.write('<INPUT TYPE="HIDDEN" ID="Fred" NAME="Fred" VALUE="' + str + '">')
document.write('</FORM>')

alert(document.forms.Dave.Fred.value)
//-->
</SCRIPT>

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Bad JavaScript bug with special characters

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap