heron
heron

Reputation: 3661

Strange database output issue

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.

Upvotes: 1

Views: 68

Answers (1)

Tim
Tim

Reputation: 792

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);

Upvotes: 2

Related Questions