htmlentities problem

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
Masaharu Akei
Posts: 1
Joined: Fri Jul 08, 2005 5:11 pm

htmlentities problem

Post by Masaharu Akei »

I installed the 1.5.0 RC4 version with mySQL on Fedora Core3.
There was a problem in a Japanese(UTF-8 ) FAQ input.
The inputted string was not displayed normally. As a result of investigating, the call of php function:'htmlentities' in 'inc/function.php' was solved by changing as follows.

htmlentities($row->thema,ENT_NOQUOTES,$PMF_LANG["metaCharset"]);

Probably, in case a multi-byte character is treated, I think that the 3rd argument needs to be specified.
--
M.akei
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

thanks for testing. It's fixed in CVS.
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
onimalu
Posts: 6
Joined: Tue Aug 30, 2005 10:04 am

htmlentities()

Post by onimalu »

Hi ,
I using phpMyFAQ1.5.0 Czech version windows-1250 and I recevieng this

Warning: htmlentities(): charset `windows-1250' not supported, assuming iso-8859-1 in /home/www/htdocs/faq15/inc/functions.php on line 111

Can you help me ?

Thanks
Last edited by onimalu on Thu Sep 01, 2005 9:44 am, edited 1 time in total.
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I'll work on a fix for that.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
onimalu
Posts: 6
Joined: Tue Aug 30, 2005 10:04 am

..

Post by onimalu »

thnx for very fast response
:)
Thorsten
Posts: 15739
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

please try this fix in inc/functions.php. PLease change the function getThema():

Code: Select all

function getThema($id, $lang)
{
	global $db, $PMF_LANG;
    $acceptedCharsets = array('iso-8859-1', 'iso-8859-15', 'utf-8', 'cp866', 'ibm866', '866', 'cp1251', 'windows-1251', 'win-1251', '1251', 'cp1252', 'windows-1252', '1252', 'KOI8-R', 'koi8-ru', 'koi8r', 'BIG5', '950', 'GB2312', '936', 'BIG5-HKSCS', 'Shift_JIS', 'SJIS', '932', 'EUC-JP', 'EUCJP');
    $result = $db->query(sprintf("SELECT thema FROM %sfaqdata WHERE id = %d AND lang = '%s'", SQLPREFIX, $id, $lang));
    if ($db->num_rows($result) > 0) {
        while ($row = $db->fetch_object($result)) {
            if (in_array($PMF_LANG["metaCharset"], $acceptedCharsets)) {
                $output = htmlentities($row->thema, ENT_NOQUOTES, $PMF_LANG['metaCharset']);
            } else {
                $output = htmlentities($row->thema);
            }
        }
    } else {
        $output = $PMF_LANG["no_cats"];
    }
    return $output;
}
bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
onimalu
Posts: 6
Joined: Tue Aug 30, 2005 10:04 am

:)

Post by onimalu »

it works

thanx
Post Reply