Categories > TinyButStrong general >

problem with "htmlconv=no"

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: olivier
Date: 2005-01-30
Time: 18:39

problem with "htmlconv=no"

Hello,

I've made a little example of my problem.
I want to pass a string to a javascript script with the parameter "htmlconv=no" don't prevent the conversion to HTML, and the '[' is converted by [

here the code to test.
the php files
<?
include_once('../tbs_class.php');
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('bug_htmlconv.html');

$chaine   = 'â à é è i ï ô ü \'';
$param[0] = 'param0';
$param[1] = 'param1';

$url = '';
$url.= '?avec_urlencode='.urlencode($chaine);
$url.= '&sans_urlencode='.$chaine;
$url.= '&param[0]='.urlencode($param[0]);
$url.= '&param[1]='.urlencode($param[1]);

$TBS->Show();
?>

the html file :
<html>
<head>
<title></title>
</head>

<body>
sans parametres :<br>
[var.url]<br>
<br>
avec htmlconv=no :<br>
[var.url;htmlconv=no]<br>
<br>
avec htmlconv=esc :<br>
[var.url;htmlconv=esc]<br>
<br>
</body>
</html>

the result in the browser :
sans parametres :
?avec_urlencode=%E2+%E0+%E9+%E8+i+%EF+%F4+%FC+%27&sans_urlencode=â à é è i ï ô ü '&param[0]=param0&param[1]=param1

avec htmlconv=no :
?avec_urlencode=%E2+%E0+%E9+%E8+i+%EF+%F4+%FC+%27&sans_urlencode=â à é è i ï ô ü '&param[0]=param0&param[1]=param1

avec htmlconv=esc :
?avec_urlencode=%E2+%E0+%E9+%E8+i+%EF+%F4+%FC+%27&sans_urlencode=â à é è i ï ô ü ''&param[0]=param0&param[1]=param1


and the source of the result
<html>
<head>
<title></title>
</head>

<body>
sans parametres :<br>
?avec_urlencode=%E2+%E0+%E9+%E8+i+%EF+%F4+%FC&amp;sans_urlencode=&acirc; &agrave; &eacute; &egrave; i &iuml; &ocirc; &uuml;&amp;param&#91;0]=param0&amp;param&#91;1]=param1<br>

<br>
avec htmlconv=no :<br>
?avec_urlencode=%E2+%E0+%E9+%E8+i+%EF+%F4+%FC&sans_urlencode=â à é è i ï ô ü&param&#91;0]=param0&param&#91;1]=param1<br>
<br>
avec htmlconv=esc :<br>
?avec_urlencode=%E2+%E0+%E9+%E8+i+%EF+%F4+%FC&sans_urlencode=â à é è i ï ô ü&param&#91;0]=param0&param&#91;1]=param1<br>
<br>

</body>
</html>


Is a problem from my code ?

Regards
Olivier

BTW:bon week-end et bonne continuation. je me régale avec TBS...
By: olivier
Date: 2005-01-30
Time: 19:00

Re: problem with "htmlconv=no" : workaround

Hello,

to make a workaround, I use the javacript 'replace' method

  var url = new String('[var.url;htmlconv=no]');
  url = url.replace(/&#91;/gi, '[')

hope this can help

Olivier
By: Skrol29
Date: 2005-01-31
Time: 00:56

Re: problem with "htmlconv=no" : workaround

Hello Olivier,

The behavior you've got is normal.
The conversion of '[' into '&#91' is a security proctection that can be canceled using parameter 'protect=no'.
[var.url;htmlconv=no;protect=no]
This is in the FAQ.
I know this can look strange but it prevents from a security hole.

Enjoy TBS,