Question

I have an html with some special html chars like   ... but tidy make for this character as space.

// tidy config
$tidyConfig = array(
    'indent' => true,
    'output-xhtml' => true,
    'input-encoding' => 'utf8',
    'output-encoding' => 'utf8',
    'show-body-only' => true,
    'fix-backslash' => true,
    'quote-marks' => true,
    'wrap' => 1024,
);

// tidy up
$string = (string)tidy_parse_string($string, $tidyConfig);

what's option must be set or change.

result http://codepad.viper-7.com/bsqD0n

Was it helpful?

Solution

How about this? http://codepad.viper-7.com/B5PDFc

bare Top Type: Boolean Default: no Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should strip Microsoft specific HTML from Word 2000 documents, and output spaces rather than non-breaking spaces where they exist in the input.

$string = 'word word   word';

// tidy config
$tidyConfig = array(
    'indent' => true,
    'output-xhtml' => false,
    'input-encoding' => 'utf8',
    'output-encoding' => 'utf8',
    'show-body-only' =>true,
    'fix-backslash' => true,
    'quote-marks' => true,
    'wrap' => 1024,
    'bare' => true,
);

// tidy up
var_dump((string)tidy_parse_string($string, $tidyConfig));

*The output-xhtml (false) is something I experimented with, but it makes no difference regarding the output (in this case)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top