Access 2000/2002 CDATA

Discussion in 'Software' started by unclematty, Mar 11, 2004.

  1. unclematty

    unclematty Private First Class

    I am storing a long HTML string inside a database. When i retreive it, all special characters come back as the codes for the characters.

    How do I use CDATA to store the string how i want it? Isnt that what CDATA does?
     
  2. Kodo

    Kodo SNATCHSQUATCH

    cdata is used for XML.. if you want to store html in a field, just send it as regular text.
     
  3. unclematty

    unclematty Private First Class

    then how do i retain the format?
     
  4. goldfish

    goldfish Lt. Sushi.DC

    you need to stick the string into the HTMLEncode() function (that is, if youre using ASP)
     
  5. Kodo

    Kodo SNATCHSQUATCH

    I'm not really sure I follow you.. HTML is just text.. just insert into the field. When you call it out of the db it will run as normal HTML..
     
  6. unclematty

    unclematty Private First Class

    Kodo: Thats what i thought. But Access changes all of the special characters i.e.(<> </>) to there codes. When I retreive this data it is not changed back to HTML.

    goldfish: Do I stick the string that is RETURNED or the one GOIN IN to the database into the HTMLEncode function?

    I guess if this doesnt work I can create a function that parsees the string for the characters and replaces them with the correct characters.
     
  7. Kodo

    Kodo SNATCHSQUATCH

    Not by default it doesn't. I use access regulary to store HTML and have NEVER seen this happen. If you HTMLencode that is going to change the text to the character equivalent essentially printing out the HTML on the screen like normal text instead of interpreting it at run time.

    Why would access "change" < or</ or other characters.. they are valid characters. If I wanted to type in </help me> and save that, it's normal text. Access hasn't a clue what's HTML and what's not.
     
  8. goldfish

    goldfish Lt. Sushi.DC

    i think its the "'s that are causing the problem, as it will escape the string when he calls it to be printed. Hmmmm...
     
  9. Kodo

    Kodo SNATCHSQUATCH

    no it won't, not on a call. If it gets inserted as a string the quotes are stored as part of that string. The only thing that needs replacing is the apostrophe's. THAT's the escape character for SQL.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds