wrong encoding ?

Found a bug? Tell us!!
Post Reply
gnr
Regular
Posts: 6
Joined: Tue Sep 05, 2006 11:11 am
Location: Poland
Contact:

wrong encoding ?

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: wrong encoding ?

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
gnr
Regular
Posts: 6
Joined: Tue Sep 05, 2006 11:11 am
Location: Poland
Contact:

Re: wrong encoding ?

Post 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 ?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: wrong encoding ?

Post by garvinhicking »

Hi!

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
gnr
Regular
Posts: 6
Joined: Tue Sep 05, 2006 11:11 am
Location: Poland
Contact:

Re: wrong encoding ?

Post 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 ?
gnr
Regular
Posts: 6
Joined: Tue Sep 05, 2006 11:11 am
Location: Poland
Contact:

Post by gnr »

It's valid now :)
Thanks a lot for help and your time.
sniff
Regular
Posts: 8
Joined: Tue Jun 20, 2006 9:54 am
Contact:

Re: wrong encoding ?

Post 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)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: wrong encoding ?

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sniff
Regular
Posts: 8
Joined: Tue Jun 20, 2006 9:54 am
Contact:

Re: wrong encoding ?

Post 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)
Post Reply