permanent errors creating cloze questions

permanent errors creating cloze questions

از Stefan Eberhard در
Number of replies: 9
In moodle 1.5 , 1.6 and 1.7 we had not problems at all to create cloze questions
In 1.8 I seem to be unable to create a close question with eg
{:MULTICHOICE: ~something ~something ~=correct}

I permanently receive this error when trying to save the question

Warning: cannot yet handle MBCS in html_entity_decode()! in /home/www/doc/16829/onlinekurse.org/www/elearning/moodle/question/type/multianswer/questiontype.php on line 713


میانگین امتیازات:  -
In reply to Stefan Eberhard

Re: permanent errors creating cloze questions

از Joseph Rézeau در
عکس Core developers عکس Plugin developers عکس Testers عکس Translators
Hello Stefan,
I cannot replicate this problem on my Moodle 1.8 test site. Here are some questions which might help clarify the situation.
What is the date of your moodle/question/type/multianswer/questiontype.php file? Latest one is :
<?php // $Id: questiontype.php,v 1.26.2.5 2007/04/04 18:01:28 tjhunt Exp $
Did your upgrade from 1.5 then to 1.6, 1.7 and 1.8 go smoothly?
Are you quite sure your moodle database is in the utf-8 system at the moment?
Which platform? (mac, windows, linux,...), which browser? which browser version?
Are there any non-ascii characters in your question text?
Could you post here a real example, not just 'something... something' of the code you are typing?
If you created questions in older Moodle versions, and backed-up / restored them to your 1.8 version, do they work OK ? Can you edit them?
Joseph
In reply to Joseph Rézeau

Re: permanent errors creating cloze questions

از Stefan Eberhard در
Hi Joseph, thanks for helping!

1. php file is:
<?php // $Id: questiontype.php,v 1.26.2.5 2007/04/04 18:01:28 tjhunt Exp $

2. we updated very smoothly. Each version did work weeks or month

3. UTF-8 Unicode (utf8)

4. I have an old question (code between the asterix). This question worked in all versions without any problems and is working in 1.8 as well.
!!! BUT !!!!
When I open this question in the question editor and then saving it without ANY changes it get some hundred warnings:

(two of them)
Warning: cannot yet handle MBCS in html_entity_decode()! in /home/www/doc/16829/onlinekurse.org/www/elearning/moodle/question/type/multianswer/questiontype.php on line 713

Warning: cannot yet handle MBCS in html_entity_decode()! in /home/www/doc/16829/onlinekurse.org/www/elearning/moodle/question/type/multianswer/questiontype.php on line 713

*************
Das aufgenommene Darlehn wird durch Banküberweisung getilgt<br />{:MULTICHOICE:~FP +~ BGA +~ W + ~F + ~BW + ~K + ~B + ~=D - ~V - ~SW -}<br />{:MULTICHOICE:~ FP -~ BGA -~ W - ~F - ~BW - ~K - ~=B - ~D + ~V + ~SW +}<br />{:MULTICHOICE:~Aktivtausch~ Passivtausch~ Aktiv-Passiv-Mehrung~= Aktiv-Passiv-Minderung}<br /><br />Wareneinkauf gegen Eigenakzept<br />{:MULTICHOICE:~FP +~ BGA +~= W + ~F + ~BW + ~K + ~B + ~D - ~V - ~SW -}<br />{:MULTICHOICE:~ FP -~ BGA -~ W - ~F - ~BW - ~K - ~B - ~D + ~V + ~=SW +}<br />{:MULTICHOICE:~Aktivtausch~ Passivtausch~= Aktiv-Passiv-Mehrung~ Aktiv-Passiv-Minderung}<br /><br />Ein Kunde zahlt für Ausgangsrechnung 23e durch Bank<br />{:MULTICHOICE:~FP +~ BGA +~ W + ~F + ~BW + ~K + ~=B + ~D - ~V - ~SW -}<br />{:MULTICHOICE:~ FP -~ BGA -~ W - ~=F - ~BW - ~K - ~B - ~D + ~V + ~SW +}<br />{:MULTICHOICE:~=Aktivtausch~ Passivtausch~Aktiv-Passiv-Mehrung~ Aktiv-Passiv-Minderung}<br /><br />
******************
Stefan

In reply to Stefan Eberhard

Re: permanent errors creating cloze questions

از Joseph Rézeau در
عکس Core developers عکس Plugin developers عکس Testers عکس Translators

Stefan,

Your question works perfectly in my Moodle 1.8, see attached screen shot.

Error message "cannot yet handle MBCS in html_entity_decode()!" is not a Moodle 1.8 error message but an Apache server message.

MBCS = Multi-Byte Character Set. See Wikipedia article.

It looks like you are having a problem with the way your apache server encodes characters. The error message is found in files apache\bin\php4ts.dll and apache\bin\php5ts.dll.

Until you find a solution (or Tim finds one) you could try to change the 3 lines which have the html_entity_decode() function in file moodle/question/type/multianswer/questiontype.php and especially change line 713 from:

$wrapped->answer[] = html_entity_decode($altregs[ANSWER_ALTERNATIVE_REGEX_ANSWER], ENT_QUOTES, 'UTF-8');

to

$wrapped->answer[] = $altregs[ANSWER_ALTERNATIVE_REGEX_ANSWER];

But there is no guarantee this will not cause other, unexpected problems, so be careful.

Joseph

Attachment image00.jpg
In reply to Joseph Rézeau

Re: permanent errors creating cloze questions

از Stefan Eberhard در
1+ 1 =
{:NUMERICAL:=2.00}
{:NUMERICAL:=2}

works fine
but juts in the moment I use
{:SHORTANSWER:3~=2}
or
{:MULTICHOICE:~3~=2}

I get the warnings!

Stefan

In reply to Stefan Eberhard

Re: permanent errors creating cloze questions

از Joseph Rézeau در
عکس Core developers عکس Plugin developers عکس Testers عکس Translators
Stefan,
If I type your exact code the Cloze question works OK (in Moodle 1.8) with all 3 types of sub-questions (NUMERICAL, SHORTANSWER & MUTLICHOICE).
I have no idea what your problem can come from.
Joseph
Attachment image00.jpg
In reply to Joseph Rézeau

Re: permanent errors creating cloze questions

از Stefan Eberhard در
Hi Joseph,

When I changed to 1.8 ten days ago, I turned Server > Debugging to ALL as I wanted to see, wether everything is ok. A couple of minutes ago, I returend to "minimal" and all the warnings vanished and the questions are accepted.

So it seems to be OK for that moment. But I dont think that it is the way it should be.

Stefan
In reply to Stefan Eberhard

Re: permanent errors creating cloze questions

از Joseph Rézeau در
عکس Core developers عکس Plugin developers عکس Testers عکس Translators
Stefan,
You should not worry too much. If you have debug set to ALL, then you will see all sorts of PHP "notices" which only alert programmers that something in their syntax is not quite as it should be. However, contrary to errors, notices do not prevent the program from running. So, don't worry!
Joseph
In reply to Joseph Rézeau

Re: permanent errors creating cloze questions

از Stefan Eberhard در
Dear Joseph,

as I have a very good ISP (artfiles.de) thea have looked and found:


Die Fehlermeldung stammt nicht direkt vom Apachen, sondern von PHP. Eine Suche nach der Fehlermeldung hat ergeben, dass die PHP4-Funktion von html_entity_decode() anscheinend kein MBCS wie bspw. UTF-8 beherrscht. Eventuell tritt das Problem bei Verwendung von PHP5 nicht auf, dieses können Sie für .php Dateien ausführen, indem Sie eine .htaccess mit folgendem Inhalt erstellen:
AddHander af_php5 .php

(no error from Apache but from PHP. html_entity_decode() MBCS in php4 cannot handle MBCS like UTF-8. Perhaps better in PHP5)

Stefan