FOSSology  4.4.0
Open Source License Compliance by Open Source Software
PagedTextResult.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014 Siemens AG
4  Author: Andreas Würl
5 
6  SPDX-License-Identifier: GPL-2.0-only
7 */
8 
9 namespace Fossology\Lib\View;
10 
11 
12 // For compatibility with older php versions
13 if (!defined('ENT_SUBSTITUTE')) {
14  define('ENT_SUBSTITUTE', 0); //This might give an empty string, but with the conversion to UTF-8 we might not run into this
15 }
16 
17 
19 {
20  const TARGET_CHARSET = "UTF-8";
21 
26  protected function renderContentText($text)
27  {
28 
29  if (self::TARGET_CHARSET == "UTF-8") {
30  return convertToUTF8($text, true);
31  }
32 
33  return htmlspecialchars(mb_convert_encoding($text, self::TARGET_CHARSET), ENT_SUBSTITUTE, self::TARGET_CHARSET);
34  }
35 }
if(! defined('ENT_SUBSTITUTE')) convertToUTF8($content, $toHTML=true)