Badwords does not filter Cyrillic

Is message board greying out your hair (at least what's left of it)? Let us help you here
Locked
strun
Posts: 2
Joined: Fri Feb 19, 2010 11:15 pm

Badwords does not filter Cyrillic

Post by strun »

Script URL:ivelin.bg/bg-ivelin/mboard
Version of script:mboard13
Hosting company:tophost.bg
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:
utf-8, preg_replace, Cyrillic, badwords, mboard, problem, encoding
Write your message below:

Hi all forum readers and mboard developers and users!

My en.php does not filter bad Cyrillic words even after inserting some in the place specified (insert new bad words below this line*/) and separating them with comma. I have also tried to create bg.php and point from settings.php to it with no effect. I have saved en.php file as utf-8 file before inserting Cyrillic letters in it. I tried to upload it to the server via ftp both ways auto and anci.

I have made some changes to mboard.php as well:

$k = htmlspecialchars($k);
$text = preg_replace("/\b$k\b/iu",$v,$text);

I have used this code with and without the specifier /u.
I have searched the forum and the internet over and over again, but cannot find another solution to the problem.
Last edited by strun on Sat Feb 20, 2010 2:23 pm, edited 1 time in total.
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Hmm, does it help if you change

Code: Select all

$k = htmlspecialchars($k); 
to

Code: Select all

$k = utf8_encode($k); 
in the code?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
strun
Posts: 2
Joined: Fri Feb 19, 2010 11:15 pm

Post by strun »

I am sorry - it does not...
I did some testing again, before posting.
I started from the beginning with new installation, did not try to translate mboard.php this time in case this causes the problem and it is saved in ansi encoding.
The only changes to mboard.php I have made are:
I have changed charset to utf-8 in the two available places;
I have added the code already mentioned in "function filter_bad_words";
I have added "header('Content-type: text/html; charset=UTF-8')" right after "<?php", because it did not look good in brower, when reading the message.
But no result so far. I am obviously making a mistake somewhere...
If I add a new word in English in en.php, it works, but not for a single one written with Cyrillic characters.
Klemen
Site Admin
Posts: 10114
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

It must be an encoding issue, but I'm afraid I'm out of ideas of why and how this is happening.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Locked