Recent Topics

1 Aug 03, 2007 00:10    

My b2evolution Version: 1.10.x

Hi,
I've problems with ru_RU utf-8 locale. I can't find where is the problem. I see only '???? ????' messages with this locale.
Other locales like de_DE works good
Does anybody know how to fix it?

Thanks for any suggestions

4 Aug 03, 2007 13:28

I just found that it is normal only in konqueror browser and firefox browser under windows. Under linux firefox still gives me "??? ???" in the blog interface.
Have you any ideas why it is so?

5 Aug 03, 2007 13:47

Looks like a Linux issue. I'd expect it the other way around: Linux displaying UTF-8 properly and not Windows. I am searching for an answer. If I find it, I come back to this topic.

Good luck

6 Aug 03, 2007 14:04

I found where is the problem.
In firefox address bar go to the about:config
Search for the intl.accept_languages parameter
I had this set to "en-us, en". I changed it to the "ru-ru, ru, en-us, en" and it solved the problem above

7 Aug 03, 2007 15:26

Heh, I found bug in word counting under ru_RU locale. It value is less than it have to be. Can anybody point me to the peace of code that counts them, so I can to fix it(at least to try)?

8 Aug 03, 2007 15:37

inc/model/items/_item.funcs.php ( approx line694 )

/**
 * Returns the number of the words in a string, sans HTML
 *
 * @param string
 * @return integer
 */
function bpost_count_words($string)
{
	$string = trim(strip_tags($string));
	if( function_exists( 'str_word_count' ) )
	{ // PHP >= 4.3
		return str_word_count($string);
	}

	/* In case str_word_count() doesn't exist (to accomodate PHP < 4.3).
		(Code adapted from post by "brettNOSPAM at olwm dot NO_SPAM dot com" at
		PHP documentation page for str_word_count(). A better implementation
		probably exists.)
	*/
	if($string == '')
	{
		return 0;
	}

	$pattern = "/[^(\w|\d|\'|\"|\.|\!|\?|;|,|\\|\/|\-\-|:|\&|@)]+/";
	$string = preg_replace($pattern, " ", $string);
	$string = count(explode(" ", $string));

	return $string;
}

¥

10 Aug 03, 2007 16:22

Thanks guys.
I don't understood why, but standard php function str_word_count don't work on my server. I have php 5 installed.
It works with english words, but not with russian in utf-8 encoding

11 Aug 03, 2007 16:29

What happens if you delete this bit and bypass the php function?

/*
    if( function_exists( 'str_word_count' ) )
    { // PHP >= 4.3
        return str_word_count($string);
    }
*/

¥

12 Aug 03, 2007 16:34

¥åßßå wrote:

What happens if you delete this bit and bypass the php function?

/*
    if( function_exists( 'str_word_count' ) )
    { // PHP >= 4.3
        return str_word_count($string);
    }
*/

¥

It gives a bit greater number. 39 instead of 12 with that code. But 39 words it is about a half that have to be

13 Aug 03, 2007 17:05

bugger, it's never the easy answer.

Can you ( temporarily ) change the code to read this :-

function bpost_count_words($string)
{
pre_dump( $string );
    $string = trim(strip_tags($string));
pre_dump( $string ); 

and send me the output ?

¥

14 Aug 03, 2007 17:16

¥åßßå wrote:

bugger, it's never the easy answer.

Ok, sorry :)
I sent it to the pm. Keep in mind that it is in russian language :p

15 Aug 03, 2007 17:25

Thanks ;)

What happens if you do this, is the count any closer?

function bpost_count_words($string)
{
     $string = trim(strip_tags($string) );
    return count( explode( ' ', preg_replace( '#[ ]{1}[^ ]#', ' ', $string ) ) );
 

16 Aug 03, 2007 17:47

¥åßßå wrote:

Thanks ;)
What happens if you do this, is the count any closer?

Yes, it is much more closer now. 177 words, I count 174 :). Error does not matter in this case B)

17 Aug 03, 2007 18:34

Without a shedload more "can you just change this to this and send me the output?", that's probably the closest I can get ;)

¥

18 Aug 04, 2007 13:49

¥åßßå wrote:

Without a shedload more "can you just change this to this and send me the output?", that's probably the closest I can get ;)
¥

What about fixing this in next releases of b2evo? You know, it is not important feature for me :D , seriously, but if it is included in the b2evo code and is enabled by default, it have to work fine, or not be included at all, right? It's just imho


Form is loading...