Advertisement

[BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Locked
User avatar
energumeno
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Oct 22, 2005 1:14 am
Location: Puerto Rico
Contact:

[BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by energumeno » Wed Oct 26, 2005 3:35 am

Hi,

i posted this on the developer zone but after reading the Purpose of this forum (http://forum.joomla.org/index.php/topic,11776.0.html), i thought it was more suited to be here.

http://forum.joomla.org/index.php/topic,13846.0.html


it is about the problem mospagebreak has when parsing a title with special characters. the issue is well explained on the first post of the thread and on the second i proposed what i think is a suitable solution to the problem or at least a much better one that what is being done.

Please read the post mentioned above to understand the problem.

To summarize it, the createTOC() function in JOOMLA_FOLDER/mambots/content/mospaging.php uses the parse_str() PHP function 3 times within lines 145 to 185 which parses the string as if it were a url querystring.

The problem is that the editor, stores every special character as its htmlencode equivalent which introduces some ampersands in the string and breaks the title when its being parsed.

My proposed solution is the following:

change every line that does parse_str:

Code: Select all

parse_str( str_replace( '&', '&', $bot[2] ), $args2 );
with

Code: Select all

parse_str( html_entity_decode( $bot[2] ), $args2 );
which will replace back the special characters from its htmlencode entity to the character itself.

but if an & is entered which will be converted to & the title will still be truncated, so my solution works for 99% of the cases but i suggest if mospagebreak doesn't have any other parameter besides title, to use whatever is placed after "title=" as the title for the TOC which completely solves the problem.


hope this is helpful
Last edited by Jinx on Thu Oct 27, 2005 12:38 pm, edited 1 time in total.
Energúmeno
PE, MCSD, MCDBA, MCT

"Aquel que no esta orgulloso de su origen, no valdrá nunca nada, pues empieza por despreciarse a sí mismo"
-- Pedro Albizu Campos

Advertisement
User avatar
Jinx
Joomla! Champion
Joomla! Champion
Posts: 6508
Joined: Fri Aug 12, 2005 12:47 am
Contact:

[BUG] - Re: Proposed Solution to mospagebreak problem with "Special Characters"

Post by Jinx » Wed Oct 26, 2005 8:42 am

Could u add this problem to the bugtracker for 1.0.x and post a link back to this forum post. Thanks.
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.joomlatools.com - Joomla extensions that just work

User avatar
energumeno
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Sat Oct 22, 2005 1:14 am
Location: Puerto Rico
Contact:

Re: Proposed Solution to mospagebreak problem with "Special Characters"

Post by energumeno » Thu Oct 27, 2005 3:07 am

Done ...

artifact: artf1809

http://developer.joomla.org/sf/go/artf1809?nav=1

Thanks
Last edited by energumeno on Thu Oct 27, 2005 3:08 am, edited 1 time in total.
Energúmeno
PE, MCSD, MCDBA, MCT

"Aquel que no esta orgulloso de su origen, no valdrá nunca nada, pues empieza por despreciarse a sí mismo"
-- Pedro Albizu Campos

kikeluke
Joomla! Apprentice
Joomla! Apprentice
Posts: 41
Joined: Tue Sep 13, 2005 11:47 am

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by kikeluke » Tue Nov 22, 2005 5:52 pm

Hola Darío,

Gracias por resolver el problema, aunque no sé si lo he hecho correctamente ya que sí me funcionan los carácteres especiales de los botones del menú "title", pero no ocurre lo mismo con la cabecera, ya sabes, el atributo "heading".

De cualquier manera muchas gracias.  :D

User avatar
viet4777
Joomla! Explorer
Joomla! Explorer
Posts: 321
Joined: Sat May 20, 2006 10:02 am
Location: Hà thành
Contact:

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by viet4777 » Mon Jun 18, 2007 6:47 am

Special Characters:
Image
Some unicode charecter cannot display in Title of MOSpagebreak, such as â, ê,..., the charecters will be replaced by ? character (see image).

I use Joomla 1.0.12

How to correct this.
Last edited by viet4777 on Mon Jun 18, 2007 6:48 am, edited 1 time in total.
http://kythuatvatlieu.org
http://kulkul.luyenkim.org
The 1st Vietnamse Portal in Metallurgy and Materials Technology
Sắt thép, nhiệt luyện, cán kéo kim loại, thiêu kết, mô phỏng, thí nghiệm, kiểm tra vật liệu, vô định hình, đúc hợp kim, tinh luyện

jcisio
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 223
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by jcisio » Mon Jun 18, 2007 8:24 am

This is just a workaround for the problem. Example: http://tintucvienthong.com/article/275/

About line 196 in mambots/content/mospagebreak.php
                        // jcisio: fix for entities in Vi
                        $bot[2] = str_replace('&', '|', $bot[2]);
                        parse_str( html_entity_decode( $bot[2] ), $args2 );
                      $args2 = str_replace('|', '&', $args2);
Of course, change '|' to anything you like, for instance chr(255). I don't use more than 1 parametres in mospagebreak so it's ok.
Last edited by jcisio on Mon Jun 18, 2007 8:28 am, edited 1 time in total.
http://www.thongtincongnghe.com/ - Thông tin công nghệ
Trang tin điện tử về CNTT, Điện tử, Viễn thông.

User avatar
viet4777
Joomla! Explorer
Joomla! Explorer
Posts: 321
Joined: Sat May 20, 2006 10:02 am
Location: Hà thành
Contact:

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by viet4777 » Mon Jun 18, 2007 8:39 am

Hi, friend,

I have fixed following this instruction from: http://forum.joomla.org/index.php/topic,13846.0.html .

And

Vietnamese users, please visit this link: http://www.joomlaviet.org/forum/index.p ... 025.0.html
http://kythuatvatlieu.org
http://kulkul.luyenkim.org
The 1st Vietnamse Portal in Metallurgy and Materials Technology
Sắt thép, nhiệt luyện, cán kéo kim loại, thiêu kết, mô phỏng, thí nghiệm, kiểm tra vật liệu, vô định hình, đúc hợp kim, tinh luyện

jcisio
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 223
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by jcisio » Mon Jun 18, 2007 8:53 am

viet4777 wrote: Hi, friend,

I have fixed following this instruction from: http://forum.joomla.org/index.php/topic,13846.0.html .
The first instruction is incomplete (for example there're many symbols à è... it doesn't process). The second suggestion works, and it's something implemented in Joomla! 1.0.12 (with some modifs...) and it still has problems. So I suggest my workaround. And I don't care if it's dirty, as mospagebreak is changed in Joomla! 1.5

For PHP fans, the syntax of str_replace in PHP is str_replace(mixed, mixed, mixed), so don't hesistate to use array.
viet4777 wrote: And

Vietnamese users, please visit this link: http://www.joomlaviet.org/forum/index.p ... 025.0.html
Poor me. I've been banned from that site.
Last edited by jcisio on Mon Jun 18, 2007 9:07 am, edited 1 time in total.
http://www.thongtincongnghe.com/ - Thông tin công nghệ
Trang tin điện tử về CNTT, Điện tử, Viễn thông.

User avatar
viet4777
Joomla! Explorer
Joomla! Explorer
Posts: 321
Joined: Sat May 20, 2006 10:02 am
Location: Hà thành
Contact:

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by viet4777 » Mon Jun 18, 2007 9:05 am

Many Thanks,

Here is the code for Vietnamese characters:
parse_str(
str_replace( 'â', 'â',
str_replace( 'ê', 'ê',
str_replace( 'ô', 'ô',
str_replace( 'á', 'á',
str_replace( 'é', 'é',
str_replace( 'ó', 'ó',
str_replace( 'ò', 'ò',
str_replace( 'õ', 'õ',
str_replace( 'í', 'í',
str_replace( 'ì', 'ì',
str_replace( 'ã', 'ã',
str_replace( 'à', 'à',
$bot[2] ))))))))))))
, $args2
);
I do not know much about coding, I try and see it OK, it means Ok for me!  :laugh:.
http://kythuatvatlieu.org
http://kulkul.luyenkim.org
The 1st Vietnamse Portal in Metallurgy and Materials Technology
Sắt thép, nhiệt luyện, cán kéo kim loại, thiêu kết, mô phỏng, thí nghiệm, kiểm tra vật liệu, vô định hình, đúc hợp kim, tinh luyện

jcisio
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 223
Joined: Mon Apr 16, 2007 2:33 pm
Contact:

Re: [BUG] - Proposed Solution to mospagebreak problem with "Special Characters"

Post by jcisio » Mon Jun 18, 2007 9:12 am

Thanks for your contribution. Still lack of some, and capital letters also.
You might use this reference to complete your code. http://www.cs.tut.fi/~jkorpela/html/guide/entities.html (official version, but more complex http://www.w3.org/TR/html4/sgml/entities.html)
http://www.thongtincongnghe.com/ - Thông tin công nghệ
Trang tin điện tử về CNTT, Điện tử, Viễn thông.

Advertisement

Locked

Return to “Superseded Issues - Archive”