Home User profile
tagDiv Member
This user did not write anything. So we are just showing here some random text to make the profile page look nice :)
dimitris
tagDiv Member

Ah, thanks man, mistake from my side. (I thought the opposite, that module is made of blocks thats why i got confused.)

dimitris
tagDiv Member

Hello can i have an answer again on this question? The panel there that controls the title length is for MODULES but i need to control it for a specific BLOCK (specifically block 15). Am i missing something obvious?

If no panel solution is available, please advise what to change in php code (just a hint -to save me some time searching in your files- will be fine, im comfortable with php)

Thank you!

dimitris
tagDiv Member

Hello there, i found what is causing the issue. It has to do with multibyte (UTF-8) characters, preg replace and json_encode.

If a title ends with capital greek letter pi Π (and possibly other multibyte characters) then something happens between your preg replace and the final json_encode. I guess the preg replace returns malformed characters, which in turn will make json_encode to fail to encode the final output, resulting in the ajax load more articles to fail.

the problem in: td_ajax.php near line 115


// remove whitespaces form the ajax HTML
    $search = array(
        '/\>[^\S ]+/s',  // strip whitespaces after tags, except space
        '/[^\S ]+\</s',  // strip whitespaces before tags, except space
        '/(\s)+/s'       // shorten multiple whitespace sequences
    );

    $replace = array(
        '>',
        '<',
        '\\1'
    );

    $buffy = preg_replace($search, $replace, $buffy);

quick fix to get rid of this thing, temporarily: just comment-out the preg_replace line so it becomes:


// $buffy = preg_replace($search, $replace, $buffy);

i had no time to investigate further due to busy schedule, but i suspect that when multibyte characters pass through preg_replace INTERNALS they are treated as non-multibyte characters, in most circumstances each multibyte character is treated as two non-multibyte characters.

so lets say multibyte “Π” character goes into preg_replace and it is becoming two characters: a weird character(1) followed by a space(2). if whatever preg_replace will do, return the characters as-is, then no problem. “Π” was seen as two characters, but its two halves(1)+(2) got returned again together so no problem. The problem is that if that “Π” is at the end of the post’s title, then it is seen as i said as two characters: a weird character(1) followed by a space(2) BUT that (2) space is matched from your pattern and gets removed. So now preg_replace returns HALF the “Π” character (only the weird (1) character since the (2) space got removed). This makes json_encode to fail due to malformed characters and of course the ajax pagination to fail.

Long-term Solutions? maybe something multibyte safe instead of preg_replace like mb-ereg-replace? Or just simply drop that trimming anyway. Why do it in the first place?

p.s. also it would be unpleasant if a multibyte characters gets split into two characters and one of them is a double quote. just saying.

  • This reply was modified 10 years by dimitris.
  • This reply was modified 10 years by dimitris.
  • This reply was modified 10 years by dimitris.
  • This reply was modified 10 years by dimitris.
dimitris
tagDiv Member
dimitris
tagDiv Member

Hello Bogdan, thanks for the response!

That dot update will be coming soon? Like before new year’s eve or something?

Thanks again
Dimitris

dimitris
tagDiv Member

Thanks Bogdan! Exactly what i needed!

Viewing 6 posts - 1 through 6 (of 6 total)