SageFix. LetsFix!  
Current Location : Home > Web Development > JavaScript > Now here's a puzzler.....! > Post Share/Save/Bookmark    

Main Menu
SageFix - Let's Fix

Board Categories
    Web Site Designing
- Graphics
    Web Development
- .NET
- Classic ASP
- JavaScript
- PHP
    WebSite Management
- Promotion Techniques
- Search Engine Optimization
    Databases
- MySQL

Tutorials

Database Connection Strings

  Contact Us


Now here's a puzzler.....!       Jul 27, 2002, 07:45 990337
  
Didn't think it would work - the character entities seem to get resolved as the page is rendered, and once that has happened, then nothing can get them back!!!

Microsoft were useless - they couldn't even be arsed to acknowledge the emails I had sent! Just completely ignored me.

However, having thought a little further ahead, I came up with a neat solution to that problem and a related one....

(Incidentally, the reason that I wanted to use character entities in this way is that I was writing a popup panel for my CMS content editor which would let users enter foreign characters and sybols, in a similar way to Windows Character Map.)

Rather than worry about inserting the correct HTML character entities at the point at which they are clicked on in the character map, I am letting the foreign characters go straight through, and I then process the entire HTML page later.

My conversion function works by using a hardcoded associative array (created by using expando properties), and then looping through each foreign character/symbol in the array, replacing each instance of it in the HTML page with the corresponding character entity.

This means that if users enter foreign characters directly into my content editor WITHOUT using my character map (perhaps using a foreign keyboard, or Windows Character Map), then these characters are caught and converted! Thus, no foreign character or symbol survives intact - by the time it reaches the DB for storage, they've all been converted.

I run this filter on the HTML code when the content editor loads, when it saves & closes, and when the user switches to HTML code view (from WYSIWYG mode).

So, in the end the .innerHTML property behaving badly didn't matter, but I would STILL like to know if it is possible to get those character entities back without having to use a lookup table...!

If this explanation isn't clear (I'm in a hurry at the moment), then please say so and I'll elaborate!

Thanks to everyone that tried to help, but it seems that we have been defeated by Microsoft's poor programming yet again!

 









Subscribe to our mailing list
email


Current Location : Home > Web Development > JavaScript > Now here's a puzzler.....! > Post Share/Save/Bookmark    

Development problem? SageFix is completely free -- paid for by advertisers and donations. Click here to Contact Us If you have any query. Enjoy!
Request processed in 7.0E-5 seconds Home - Contact Us - Terms Of Service - Privacy Policy - Copyrights - Top
Advertisements do not imply our endorsement of that product or service.
Current server time now is 06-Sep-2010 07:07:22
Copyright © 2009 Sagefix Inc. All rights reserved.
Powered By SageFix