1

I'm storing program in my database table as it is (I mean no spec. charaacter encoding, etc.. just copying and pasting into db). something like

#include <pthread.h>
#include <errno.h>
#include <vmcmt.h>
...

And here is PHP

ob_start();
...
fetching information from database and echoing    
$markup = ob_get_clean();

// Specify configuration
$config = array(
    'indent' => true,
    'output-xhtml' => true,
    'wrap' => 200);

// Tidy
$tidy = new tidy;
$tidy->parseString($markup, $config, 'utf8');
$tidy->cleanRepair();

// Output
echo $markup;

The problem is, I'm getting oupput code from database half lost. I mean output must be #include <pthread.h> getting just #include.

What I've done

FIrst I thought, maybe it's related with tidy class: turned on debug, and I saw that it's ok with $markup. But when I echoed it, got same result. Tried to remove all output buffering functions, tidy.. and just echo content. Still same result. I can't figure out, what am I missing.

3
  • at what point is the html lost? view source and check if one of the tags does not break it. i.e. if the source actually finishes where your output does. Commented Aug 13, 2012 at 18:02
  • @KasiaGogolek while echo-ing final output. Commented Aug 13, 2012 at 18:04
  • I gathered that, I meant at what point of the output html source. Commented Aug 14, 2012 at 8:03

1 Answer 1

2

Have a look at your HTML page source code. <pthread.h> is assumed to be a html tag. You need to

// Output
echo htmlentities($markup);
Sign up to request clarification or add additional context in comments.

5 Comments

lol:))) Now I have no page but html mess.. just markup. nothing visual
Why is that? More than that, you should display your page in UTF-8 encoding.
you can take a look with teamviewer if you want.
echo nl2br(htmlentities($markup)); doesn't it solve the issue with new lines?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.