Page 1 of 1

wrong encoding ?

Posted: Tue Sep 05, 2006 12:27 pm
by gnr
I have problem with validating my blog with validator.w3.org
The frontpage is ok - http://tinyurl.com/ltw9x
But for example - http://tinyurl.com/qehyy - there is some problem with encoding and it's not related with themes (i've tried several themes with the same effect).
Is it a bug ?
My blog is powered by nightly 200608301338

Re: wrong encoding ?

Posted: Tue Sep 05, 2006 12:50 pm
by garvinhicking
Hi!

That's a problem sadly because of bad escaping: In line 103 you see this:;

Code: Select all

                        <a rel="nofollow" style="font-weight: normal" href="http://gnr.stodola.net.pl/s9y/comment.php?type=trackback&entry_id=17" onclick="alert('Nie klikaj na ten link. Zawiera on URI ze Å�ladem (Trackback) dla tego wpisu. Możesz użyÄ� tego URI by wysÅ�aÄ� pinga lub stworzyÄ� Å�lad ze swojego bloga do tego wpisu. Aby skopiowaÄ� ten URI kliknij prawym przyciskiem myszy na linku i wybierz opcjÄ� "Kopiuj skrót" (lub podobnÄ�).'); return false;" title="Nie klikaj na ten link. Zawiera on URI ze Śladem (Trackback) dla tego wpisu. Możesz użyć tego URI by wysłać pinga lub stworzyć Ślad ze swojego bloga do tego wpisu. Aby skopiować ten URI kliknij prawym przyciskiem myszy na linku i wybierz opcję "Kopiuj skrót" (lub podobną).">Użyj tego linku jeśli chcesz stworzyć Ślad (Trackback) do tego wpisu</a>
whiuch contains bad characters. You will need to edit your template and search for

Code: Select all

onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:htmlall}');
and replace it with

Code: Select all

onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:html}');
I think that the bad characters should go away then?

Best regards,
Garvin

Re: wrong encoding ?

Posted: Tue Sep 05, 2006 1:22 pm
by gnr
garvinhicking wrote:Hi!

You will need to edit your template and search for

Code: Select all

onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:htmlall}');
and replace it with

Code: Select all

onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:html}');
Sorry but I don't understand. Which file should I edit ?

Re: wrong encoding ?

Posted: Tue Sep 05, 2006 1:40 pm
by garvinhicking
Hi!

Oh, sorry. The 'entries.tpl' file!

Regards,
Garvin

Re: wrong encoding ?

Posted: Tue Sep 05, 2006 1:51 pm
by gnr
garvinhicking wrote:The 'entries.tpl' file!
but theme which I use (joshua) doesn't have this file, only index.tpl.
Should I edit 'entries.tpl' which is in 'default' subdirectory ?

Posted: Tue Sep 05, 2006 7:36 pm
by gnr
It's valid now :)
Thanks a lot for help and your time.

Re: wrong encoding ?

Posted: Fri Sep 08, 2006 9:52 pm
by sniff
garvinhicking wrote:Hi!

That's a problem sadly because of bad escaping.
You will need to edit your template and search for

Code: Select all

onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:htmlall}');
and replace it with

Code: Select all

onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:html}');
I think that the bad characters should go away then?

Best regards,
Garvin
Hi Garvin, I still think that it's a problem of @escape:htmlall - this function should escape characters after it recognizes charset. This isn't done because it is trying to escape every byte of text even it is multibyte text (it escapes 2 characters instead of one 2-byte character)

Re: wrong encoding ?

Posted: Sat Sep 09, 2006 12:34 am
by garvinhicking
Hi!

I agree, this should be fixed in the internal smarty function. Would you like to report it to smarty.php.net?

Best regards,
Garvin

Re: wrong encoding ?

Posted: Sat Sep 09, 2006 10:39 am
by sniff
garvinhicking wrote: I agree, this should be fixed in the internal smarty function. Would you like to report it to smarty.php.net?
Hmmmm, interesting site :) Have no experience with smarty, but I see that there is a second parameter for encoding possible. This encoding is ISO-8859-1 by default. So I did this chage:

Code: Select all

onclick="alert('{$CONST.TRACKBACK_
SPECIFIC_ON_CLICK|@escape:htmlall}');
to

Code: Select all

onclick="alert('{$CONST.TRACKBACK_
SPECIFIC_ON_CLICK|@escape:htmlall:$head_charset}');
And it works well!

(I am not sure, if $head_charset is the right variable)