Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 20th, 2004, 07:33 AM
Friend of Wrox
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: New Delhi, India.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubhav.kumar
Default Storing and Displaying Formatted Strings

Greetings to all.

I have to display chemical equations and algebric equations on html page.
These equations are the part of the questions in an online examination.
i don't want to use images for performance considerations.
The questions are being composed offline and uploaded to online database. (MS Access for now. May be SQL Server in future)

My Problem is:

How can i store formatted strings in database involving special characters and superscript and subscript?

How can we retrieve the string from database along with formatting to display them correctly?

Anubhav Kumar
__________________
Anubhav Kumar
http://anubhavtimepass.blogspot.com/
Reply With Quote
  #2 (permalink)  
Old October 20th, 2004, 10:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Anubhav Kumar,

There are tags for Superscript and SubScript. Here you go.
Code:
Do you want to see what is <sub>SubScript</sub> and how does a <sup>SuperScript</sup> look?
Check this link for Special Characters

When you store data on to db, you can store the formatted string, so that just read from db and display would give you the formatted effect.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #3 (permalink)  
Old October 20th, 2004, 12:32 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

You want to use a string like in the previous post, and then Server.HtmlEncode() when you store it in the database. Then do Server.HtmlDecode() when showing to the screen.

Brian
Reply With Quote
  #4 (permalink)  
Old October 20th, 2004, 01:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Actually there is no HTMLDECODE as such. So you got to write a function something like this, that does the decode for you, when displaying the content.
Code:
Private Function HTMLDecode(byVal encodedstring)
    Dim tmp, i
    tmp = encodedstring
    tmp = Replace( tmp, "&quot;", chr(34) )
    tmp = Replace( tmp, "&lt;"  , chr(60) )
    tmp = Replace( tmp, "&gt;"  , chr(62) )
    tmp = Replace( tmp, "&amp;" , chr(38) )
    tmp = Replace( tmp, "&nbsp;", chr(32) )
    For i = 1 to 255
        tmp = Replace( tmp, "(*)#" & i & ";", chr( i ) )
        There is some issue with the & used along with # here.
        So I have used (*) in the previous line. Replace that with &
        Will post a feedback on this issue.
    Next
    HTMLDecode = tmp
End Function
Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old October 21st, 2004, 07:01 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Sure there is an HTMLDecode, see MSDN: [link]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpserverutilityclasshtmldecodetopi c.asp[/link].

Brian
Reply With Quote
  #6 (permalink)  
Old October 21st, 2004, 11:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Brian,

Looks like that page doesn't exist. Takes me to 404 error - Location Cannot Be Found
Can you point me to the right page if any?

Is that true? I never knew that. Then why does that show me an error when I try to use?
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'Server.HTMLDecode'

And google too never throws me an MS site link related to that. Wondering!

May be .Net's SERVER object supports HTMLDECODE, not the ASP SERVER object.

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #7 (permalink)  
Old October 21st, 2004, 12:06 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

When I originally submitted the post, I didn't even realize that this was ASP 3. My apologies.

Brian
Reply With Quote
  #8 (permalink)  
Old October 25th, 2004, 04:59 AM
Friend of Wrox
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: New Delhi, India.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubhav.kumar
Default

Thanks for consideration to all.

Dear Vigay G.

Its true that the solution given by you and Brians will definetly work. I already know that. I just want a suggestion, is there any tool through which we can compose html formatted pages and store them in databases?

Anubhav Kumar
Reply With Quote
  #9 (permalink)  
Old October 25th, 2004, 06:57 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Anubav,

May be you can develop one such, considering all the points to format that and store into database which can be reusable. I haven't come across such tool as such.

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #10 (permalink)  
Old October 25th, 2004, 09:42 AM
Friend of Wrox
Points: 410, Level: 7
Points: 410, Level: 7 Points: 410, Level: 7 Points: 410, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: New Delhi, India.
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anubhav.kumar
Default

Dear Vijay G.

I am planning to develop a tool in VB for that. The real stuck for me is to implement editing commands for superscript, subscript and special characters in Rich Text Box

I know this is asp forum but the problem is realated . Please don't mind

Anubhav Kumar
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing images in Database and displaying them Manoj Bisht ASP.NET 1.x and 2.0 Application Design 4 February 6th, 2010 03:06 AM
NOT WELL FORMATTED pallone XSLT 7 June 24th, 2008 04:45 PM
How to store and retrieve formatted strings in db jessi Classic ASP Professional 2 March 9th, 2007 07:27 AM
problem in the displaying two strings abhit_kumar JSP Basics 0 March 15th, 2005 05:56 AM
Storing a unknown number of strings to an Array PanzarPaw Classic ASP Basics 4 November 21st, 2003 12:14 PM



All times are GMT -4. The time now is 11:33 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.