vmars316 Posted February 7, 2015 Share Posted February 7, 2015 Hello & Thanks , Need help, I can't figure out what's wrong with this code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN "> <html><head> <meta charset="utf-8"><title>xRainbow-Project</title> <style> table td {border: 1px solid black; color: Black;}</style> </head><body> <TABLE> <TR><TD style= "height: 50px; background-color: #E6E9FE "e;>0,0,E6E9FE <TR><TD style= "height: 50px; background-color: #E7EAFF "e;>1,0,E7EAFF </Table> </body> </html> Thanks..vm Link to comment Share on other sites More sharing options...
Ingolme Posted February 7, 2015 Share Posted February 7, 2015 What are all those " and "e; doing in your code? Link to comment Share on other sites More sharing options...
davej Posted February 7, 2015 Share Posted February 7, 2015 You need to paste your code inside a <> code-block or some characters will get converted into codes. Your table looks messed up. How many rows and how many columns do you want? Link to comment Share on other sites More sharing options...
Ingolme Posted February 7, 2015 Share Posted February 7, 2015 You need to paste your code inside a <> code-block or some characters will get converted into codes. Your table looks messed up. How many rows and how many columns do you want? It's not the lack of code block that caused this, this is his own code. Since "e; is not actually a real HTML entity it's clear he typed that himself. Link to comment Share on other sites More sharing options...
vmars316 Posted February 7, 2015 Author Share Posted February 7, 2015 Thanks, I generate the code from a program . Here is a sample of the code . I can't hand the program any imbedded " so I am using " instead . Any suggestions ? Thanks..vm Procedure FileOut(OneLine$) ; Input file looks like this: ; 41,1,E0FCE9 ; 42,1,E0FAE8 ;TBox02.s = "E0FCE9" ; Output file looks like this ;OneLine$ = TableRow If FileOpen = 0 ; MessageRequester("FileOpen = 0", "ColorTable.html") If CreateFile(2, "ColorTable.html") FileOpen = 1 WriteStringN(2,"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">") WriteStringN(2,"<html><head>") WriteStringN(2,"<meta charset="utf-8"><title>xRainbow-Project</title>") WriteStringN(2,"<style>") WriteStringN(2,"table td {border: 1px solid black; color: Black;}</style>") WriteStringN(2,"</head><body>") WriteStringN(2,TableBeg$) Else MessageRequester("PureBasic", "Error: can't Create file", 0) End EndIf ; CreateFile(2, EndIf ; FileOpen = 0 Link to comment Share on other sites More sharing options...
Ingolme Posted February 7, 2015 Share Posted February 7, 2015 " causes the HTML to not work. In some languages escaping quotes is done with a backslash ("). This looks similar to ASP, I think in ASP you escape a quote by writing it twice: "" Link to comment Share on other sites More sharing options...
vmars316 Posted February 7, 2015 Author Share Posted February 7, 2015 What are all those " and "e; doing in your code? OH, Thanks, I just noticed the "e;'s in there . Let me replace all the "e; with &qout; and rerun it... Link to comment Share on other sites More sharing options...
Ingolme Posted February 7, 2015 Share Posted February 7, 2015 That's still not going to work. Read my more recent reply. Link to comment Share on other sites More sharing options...
davej Posted February 7, 2015 Share Posted February 7, 2015 Why are you generating an HTML page with PureBasic? Link to comment Share on other sites More sharing options...
vmars316 Posted February 8, 2015 Author Share Posted February 8, 2015 Hello & Thanks , Turns out I needed to create a DoubleQuote constant (#DQ$ = chr(34)) and then all went well . Here is the winning line: LTTD01$ = "<TR><TD style="+#DQ$+"height:50px; background-color:#"+TBox02dot$+";"+#DQ$+">"+OneLine$+"</TD>" If anyone is interested, I am happy to Post the PureBasic code, 111 Lines. Thanks All !..vm Link to comment Share on other sites More sharing options...
funbinod Posted February 8, 2015 Share Posted February 8, 2015 in simple language - what everyone above are saying is don't use any charcode for html. use the characters themselves.. not like what u wrote-- style= "height: 50px; background-color: #E6E9FE "e; in stead write -- style="height: 50px; background-color: #E6E9FE;" Link to comment Share on other sites More sharing options...
dsonesuk Posted February 8, 2015 Share Posted February 8, 2015 The solution would be to escape double quotes as already mentioned with '' so they will not treated as part of the doubles quotes surrounding text string code, OR use single quotes instead so conflict with double quotes does not become a problem. Link to comment Share on other sites More sharing options...
funbinod Posted February 8, 2015 Share Posted February 8, 2015 is using double quotes in HTML is a problem that they should be escaped?? sorry I've less idea about this... Link to comment Share on other sites More sharing options...
dsonesuk Posted February 8, 2015 Share Posted February 8, 2015 No, but trying to insert html code which include double quotes using server language ASP.net, PHP can be unless you escape, OR use method i mentioned. Link to comment Share on other sites More sharing options...
vmars316 Posted February 8, 2015 Author Share Posted February 8, 2015 Thanks , The following line of PB (pure basic) that creates the proper html-code is this: LTTD01$ = "<TR><TD style="+#DQ$+"height:50px; background-color:#"+TBox02dot$+";"+#DQ$+">"+OneLine$+"</TD>" The code that Chrome (etc.) sees is this: <TR><TD style="height:50px; background-color:#E6E9FE;">0,0,E6E9FE</TD> I am happy with this. I don't understand what you mean by "escape-code". Thanks..vm Link to comment Share on other sites More sharing options...
Ingolme Posted February 8, 2015 Share Posted February 8, 2015 This is the concept being referred to: http://en.wikipedia.org/wiki/Escape_character You want to put a double-quote inside a string delimited by double-quotes. The solution is to use what's called an "escape sequence" or "escape character". Different programming languages have different ways to do it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now