Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Mizar on October 14, 2005, 08:43:32 AM

Title: Bug in parser_bbc() function ?
Post by: Mizar on October 14, 2005, 08:43:32 AM
I have posted recently a topic about a problem in the display of topic containing à letter.

I modify the function parse_bbc() in /source/subs.php

// The idea is, find words xx long, and then replace them with xx + space + more.
if (strlen($data) > $modSettings['fixLongWords'])
{
// This is done in a roundabout way because $breaker has "long words" :P.
$data = strtr($data, array($breaker => '< >', '&nbsp;' => "\xA0"));
$data = preg_replace(
'/(?<=[>;:!? \xA0\]()]|^)([\w\.]{' . $modSettings['fixLongWords'] . ',})/e',
"preg_replace('/(.{" . ($modSettings['fixLongWords'] - 1) . "})/', '\\\$1< >', '\$1')",
$data);
$data = strtr($data, array('< >' => $breaker, "\xA0" => '&nbsp;'));
}


changing all occurencies of:

xA0

with

x00A0

Now all my à  letter remain à also when the text is longer than $modSettings['fixLongWords']

P.S.
I don't know if this is valid for all. In my utf-8 forum work good.

Bye
Title: Re: Bug in parser_bbc() function ?
Post by: taka on January 02, 2006, 02:28:21 PM
Unfortunately, it's not working as expected.  See following document:

http://us3.php.net/manual/en/language.constants.php (http://us3.php.net/manual/en/language.constants.php)

Your code means three characters, null char, 'A' and '0'.  The bug is in the string literal which hardcoded '\xA0' in there.  The right fix is to remove that character. 
Title: Re: Bug in parser_bbc() function ?
Post by: SacmaliK on October 01, 2006, 01:30:42 PM

// This is done in a roundabout way because $breaker has "long words" :P.
$data = strtr($data, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0"));
$data = preg_replace(
'~(?<=[>;:!? ' . ($context['utf8'] ? '\x{C2A0}' : '\xA0') . '\]()]|^)([\w\.]{' . $modSettings['fixLongWords'] . ',})~e' . ($context['utf8'] ? 'u' : ''),
"preg_replace('/(.{" . ($modSettings['fixLongWords'] - 1) . '})/' . ($context['utf8'] ? 'u' : '') . "', '\\\$1< >', '\$1')",
$data);
$data = strtr($data, array('< >' => $breaker, $context['utf8'] ? "\xC2\xA0" : "\xA0" => '&nbsp;'));



I While the message send fatal error  :'(

$data = strtr($data, array($breaker => '< >', '&nbsp;' => $context['utf8'] ? "\xC2\xA0" : "\xA0"));

Is there the mistake?
Title: Re: Bug in parser_bbc() function ?
Post by: codenaught on October 03, 2006, 05:12:23 PM
I don't see any parse error in the code you posted. Are you sure this change is even needed? This topic was started nearly a year ago and when I tested out posting long words with just "à" in them I didn't see any problems.
Title: Re: Bug in parser_bbc() function ?
Post by: karag8z on January 29, 2009, 06:19:49 AM
bendeki hata images hack eklemelerini kaldırınca çözüldü. popup url + pop up image duruyor. images hack entegrasyonunu nasıl çözerim bilmem ama