Problem w/Cyrillic embedded answer (CLOZE) questions

Problem w/Cyrillic embedded answer (CLOZE) questions

by Robert Collazo -
Number of replies: 13
I'm having some problems with instructors posting embedded answer (CLOZE) questions in Moodle.  This is an example of what they post:

Министр иностранных дел палестинской администрации назвал {1:SHORTANSWER:=целевые} убийства Израилем {1:SHORTANSWER:=радикалов} из Хамаса {1:SHORTANSWER:=преступлением}, которое только усилит цикл насилия. {1:SHORTANSWER:=На} {1:SHORTANSWER:=Западе} растёт озабоченность, что в случае продолжения насилия, мирный план {1:SHORTANSWER:=Дорожная} {1:SHORTANSWER:=Карта} может {1:SHORTANSWER:=провалиться}.

And then this is what is returned:
Министр иностранных дел палестинской администрации назвал {1:SHORTANSWER:=&\#1094;&\#1077;&\#1083;&\#1077;&\#1074;&\#1099;&\#1077;} убийства Израилем {1:SHORTANSWER:=&\#1088;&\#1072;&\#1076;&\#1080;&\#1082;&\#1072;&\#1083;&\#1086;&\#1074;} из Хамаса {1:SHORTANSWER:=&\#1087;&\#1088;&\#1077;&\#1089;&\#1090;&\#1091;&\#1087;&\#1083;&\#1077;&\#1085;&\#1080;&\#1077;&\#1084;}, которое только усилит цикл насилия. {1:SHORTANSWER:=&\#1053;&\#1072;} {1:SHORTANSWER:=&\#1047;&\#1072;&\#1087;&\#1072;&\#1076;&\#1077;} растёт озабоченность, что в случае продолжения насилия, мирный план {1:SHORTANSWER:=&\#1044;&\#1086;&\#1088;&\#1086;&\#1078;&\#1085;&\#1072;&\#1103;} {1:SHORTANSWER:=&\#1050;&\#1072;&\#1088;&\#1090;&\#1072;} может {1:SHORTANSWER:=&\#1087;&\#1088;&\#1086;&\#1074;&\#1072;&\#1083;&\#1080;&\#1090;&\#1100;&\#1089;&\#1103;}.

When a student types the answer in cyrillic, the answer is correct (assuming that they've put in the right one).  However, when they miss the answer and the review is turned on to show them what the correct answer should be, it appears as something like, "
&\#1087;&\#1088;&\#1086;&\#1074;&\#1072;&\#1083;&\#1080;&\#1090;&\#1100;&\#1089;&\#1103;"

Any suggestions for fixing this or displaying the answer in cyrillic?


Average of ratings: -
In reply to Robert Collazo

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Julian Sedding -
I am investigating...It seems to be a problem with escaping/unescaping characters.
In reply to Robert Collazo

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Julian Sedding -
Ok, I have committed a fix to CVS (will be in the download package tomorrow I think). Copying the example provided above this works for me now. Please let me know if the fix also solves the problem on your machine.

Julian
In reply to Julian Sedding

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Robert Collazo -
Julian,

The patch did not solve my problem.  I checked out the CVS and it still does the same thing (converts the Cyrillic to
&\#1087;&\#1088;&\#1077;&\#1089;&\#1090;&\#1091;&\#1087;&\#1083;&\#1077;&\#1085;&\#1080;&\#1077;&\#1084;".
It only does it though in between the { } chars.

Robert
In reply to Robert Collazo

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Dmitry Pupinin -
Picture of Core developers Picture of Plugin developers
Search on forums about function htmlentities
In reply to Dmitry Pupinin

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Robert Collazo -
Dmitry,

I found this post regarding changing

$text = htmlentities($text);
to
$text = htmlentities($text,ENT_COMPAT,get_string("thischarset","moodle"));

in lib/weblib.php

I did that and I'm still having the problem with the cyrillic being converted from this:
Поезд {1:SHORTANSWER:=отправлялся} {1:SHORTANSWER:=ночью},

to

Поезд {1:SHORTANSWER:=&\#1086;&\#1090;&\#1087;&\#1088;&\#1072;&\#1074;&\#1083;&\#1103;&\#1083;&\#1089;&\#1103;} {1:SHORTANSWER:=&\#1085;&\#1086;&\#1095;&\#1100;&\#1102;},

Thanks,
Robert

In reply to Robert Collazo

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Julian Sedding -
Hmmm... I don't understand why the '#' seems to be escaped in your examples. the fact that it only happens inside the {} indicates that it is not a DB or PHP settings issue but resides in the code.

Anyway, can you tell me which version of PHP you're using, if you have any unusual language settings in moodle, which character encoding you're using in your browser and which browser you're using.

Additionally, can you please clarify the following:
- In your first post you wrote: "And then this is what is returned" --- what exactly do you mean? Is that when you go back to the question editing page?
- You also wrote "However, when they miss the answer and the review is turned on to show them what the correct answer should be, it appears as something like..." --- As far as I know the display of correct answers is not implemented for cloze questions. So where exactly do your students see the correct answers displayed incorrectly?

Julian

PS: Maybe you quickly test again with a new checkout form CVS before replying - I think anonymous CVS access is slightly delayed with respect to developers access, so you could just rule out that possibility, please! Cheers!
In reply to Julian Sedding

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Robert Collazo -

Julian,

Ok, just did another checkout from CVS.  Same problem.

I'm running Apache/2.0.54 (Gentoo/Linux) mod_ssl/2.0.54 OpenSSL/0.9.7e PHP/4.3.11 mod_jk2/2.0.4 (taken from phpinfo()).  I'm using Mozilla Firefox v1.0.6 and IE 6.0.2900.2180.xp2_sp2 (it happens in both browsers).  The instructors are copying the material from both Word 2003 and RTF docs and pasting it in the editor.  The encoding in Firefox is set to Western (ISO-8859-1) and in IE it is set to Western European (Windows).  I don't have any unusual language settings in Moodle - using English as the default language.

Sorry I wasn't clear enough.  Yes, when the instructor goes back to the question editing page for cloze questions, they see the escaped characters.

As for the correct answers displayed incorrectly, I was under the impression that it was in the cloze exercises.  It is actually in the "Short Answer" exercises.  My mistake.

All your help is appreciated.

Thanks,
Robert

In reply to Robert Collazo

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Julian Sedding -
Have you also checked out the new version of mod/quiz/questiontypes/multianswer/editquestion.php? If I include the previous version I get the error described by you (at least the &\#1234; like corrupted entities in the question editing). I have only modified the editquestion.php and questiontype.php files, but please make sure you upgrade at least the whole multianswer folder.

Julian
In reply to Julian Sedding

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Robert Collazo -
Julian,

This is the header off of the version I checked out from CVS:

$Id: editquestion.php,v 1.5.2.3 2005/09/07 13:59:27 mindforge Exp $

Thanks,
Robert
In reply to Robert Collazo

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Julian Sedding -
I'm not sure exactly, where your problem is. You mentioned shortanswer earlier. Together with Eloy I have made some modifications that could have lead to the display of entities instead of cyrillic characters. This can not answer the question though, why you still have '\' in the entities. After my previous changes to editquestion.php and questiontype.php this should not be possible anymore.

Can you please upgrade the following two files /lib/weblib.php and /mod/quiz/questiontypes/shortanswer/questiontype.php (and make sure that weblib has already changed (Eloy will be committing that as I am typing *hope*). If you can then (only with new questions, because cloze questions using cyrillic in the database can still be corrupt) please test the following and tell me of any remaining problems you encounter:
- create and edit a shortanswer question and a cloze question
- preview them individually with questionpreview (popup window)
- preview them in a quiz and make an attempt, so you also get redirected to the review page.

I hope I'm getting to the bottom of this slowly...

Julian
In reply to Julian Sedding

Re: Problem w/Cyrillic embedded answer (CLOZE) questions

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Julian and Robert,

finally I've postponed the CVS commit of weblib.php until I had some feedback from Martin, mainly because p() and s() are really used functions and perhaps he was able to detect some problems with the changes proposed.

Anyway, I've sent you the modified weblib.php privately. Please test it against the whole Moodle.

Ciao smile