Categories > TinyButStrong general >

Problems with specialchars (©)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Horst
Date: 2003-08-12
Time: 15:26

Problems with specialchars (©)

Hi there,

I have some Problems with specialchars.
I want do something similar to:
PHP:
$my_strvar  = "<script type=\"text/JavaScript\">\n";
$my_strvar .= "<!--\n";
$my_strvar .= "document.write('string with specialchars: &copy; or german Umlauts &uuml; &auml; &ouml;');";
$my_strvar .= "//-->\n";
$my_strvar .= "</script>\n";
$my_strvar .= "<noscript>\n";
$my_strvar .= "<p>If you enable JavaScript you ... </p>\n";
$my_strvar .= "</noscript>\n";

HTML:
[tbs_check.one;if [var.mycheckvar]=1;then [var.my_strvar;htmlconv=no]]

But TBS breaks the parsing after the first ; in my string (in the example is this -&copy;-) The rest will shown as unparsed code.

Did someone know a solution?

Best regards,
Horst
By: Skrol29
Date: 2003-08-12
Time: 18:30

Re: Problems with specialchars (&copy;)

Hello Horst,

This HTML should work better:
[tbs_check;if [var.mycheckvar]=1;then [var.my_strvar;htmlconv=no];htmlconv=no]

remarks:
1/ [tbs_check.something] is for conditional block. Use [tbs_check] for a conditional value.
2/ You have to propagate the 'htmlconv=no' or you'll have the conversion.
By: Horst
Date: 2003-08-13
Time: 18:17

Re: Problems with specialchars (&copy;)

Hi Skrol29,

yes this works better, but not perfect :(

TBS ever breaks parsing at the first semicolon of the first document.write('...');

The output in parsed HTML is like:

<script type=\"text/JavaScript\">
<!--
document.write('string with specialchars: &copy; or german Umlauts &uuml; &auml; &ouml;')

Note: the semicolon isn't visible and also the rest of $mystrvar!

Is it possible to tell TBS to handle this ; as a char what it has to type?

Greets,
Horst
By: Skrol29
Date: 2003-08-15
Time: 13:15

Re: Problems with specialchars (&copy;)

I'm having a look....
By: Skrol29
Date: 2003-08-15
Time: 13:32

Re: Problems with specialchars (&copy;)

Ok, I think I understand what happen.

If you use the folowing HTML it should be ok:
[tbs_check;if [var.mycheckvar]=1;then '[var.my_strvar;htmlconv=esc]';htmlconv=no]

The point is that TBS merges [var.*] tags first and merges [tbs_check] after.
In your case, when TBS merge the [check] tag, the 'then' part is not string protected, so it take the string from "<script..." and to the first semilicon. If there were a closing character "]" it also cut the string.

To protect the string, I've put it between '' and I've escaped it with 'html=esc'.

It worked for me, tel me if it's ok for you.
By: Horst
Date: 2003-08-26
Time: 16:21

Re: Problems with specialchars (&copy;)

Hi Skrol,

thank's for your reply.

Yes, now it works very well.

Hint: One have to use doublequotes instead of singlequotes in $my_strvar!
PHP:
Doesn't work:
...
$my_strvar .= "document.write('string with specialchars: &copy; or german Umlauts &uuml; &auml; &ouml;');";
...

PHP:
Works =:)
...
$my_strvar .= "document.write(\"string with specialchars: &copy; or german Umlauts &uuml; &auml; &ouml;\");";
...

HTML:
[tbs_check;if [var.mycheckvar]=1;then '[var.my_strvar;htmlconv=esc]';htmlconv=no]

Thank's for the help and for sharing TBS ;-)
Horst