marcusgreen / moodle-qtype_gapfill

Fill in the blanks question type with very easy to learn syntax
6 stars 20 forks source link

Latin letter o with acute #106

Closed mister-mori closed 1 year ago

mister-mori commented 1 year ago

Describe the bug Hello. I am having some troubles with latin letter o with acute (https://en.wikipedia.org/wiki/ó).

When I type "ó" the answer will always be considered as false (screenshot 1). That's because in this plugin html sees "ó" as "& oacute;" (no space after &) (as we can see on screenshot 2). So in order to get the answer correct students need to type "& oacute;" (no space after &) instead of "ó", which is absolutely inconvenient (screenshot 3).

Expected behavior There are some examples of shortanswer question type and embedded answers (cloze) question type with the following source code (screenshots 4, 5) and everything works fine.

Screenshots Screenshot 1 Screenshot_1 Screenshot 2 Screenshot_2 Screenshot 3 Screenshot_3 Screenshot 4 Screenshot_4 Screenshot 5 Screenshot_5

marcusgreen commented 1 year ago

What is your setting for regex? https://docs.moodle.org/402/en/Gapfill_question_type#Disable_Regex

mister-mori commented 1 year ago

It is ticked. Unticking it does nothing, it behaves the same way. Screenshot_1 Screenshot_2

marcusgreen commented 1 year ago

Can you give me the text of the question (or an xml export). Here is my attempt to reproduce it attached as xml. oactue_gapfill.txt

Rename the file to give it the xml extension then import it as a question type.

Here is the main bit.

[ź]oty[ó]

mister-mori commented 1 year ago

Here is a video of me trying your file. The result is the same. "ó" is considered wrong. https://youtu.be/CDNWnh22C-0

Here is my question. questions-PLA1-Lekcja 01 Słownictwo 1 Część H Ćwiczenie 3 (PROBLEM WITH Ó)-20231009-1455.txt

marcusgreen commented 1 year ago

My apologies, I had not appreciated you are asking about what happens when the letter is typed in rather than dragged from an option. What keystroke combination or setup do you use to key in the ó character?

Could you attach the xml of a core question type that is handling this correctly?

marcusgreen commented 1 year ago

I have done some more investigation. If I switch to the polish keyboard layout and enter the ó character by pressing AltGr and the O key, it will enter that character which is graded as correct by the question type. It will not process the html equivalent (&oactute;), which is as you note not a good way of entering text. Please let me know what the difference is between what I have just done and what you experiences.

It would be nice if the editor/question type could present a list of the extended characters used in the current language pack.

mister-mori commented 1 year ago

That's the exact same way I enter the "ó" character (by pressing AltGr and the O key). There is a video (with on-screen keyboard) of me creating a question from scratch where I'm entering some words with the "ó" character. All of them are still considered wrong. But when I enter & oacute; (no space after &) instead of the "ó" character all the words are considered correct.

But when I do the same with the short answer question type, everything works fine. https://www.youtube.com/watch?v=SJuOoQkFncQ

marcusgreen commented 1 year ago

Would you be able to give me teacher access to a course so I can reproduce it myself. I am at a loss to know what is happening. I have asked some other people for their opinion on this. I really want the question type to deal with this.

mister-mori commented 1 year ago

I have just created a private repository, invited you. Login data is in the issues area. image

Also I left an attempt (preview) with the following results: Screenshot 1 Screenshot_1 Screenshot 2 Screenshot_2 Screenshot 3 Screenshot_3

PhilippImhof commented 1 year ago

FWIW, I just gave this a try on my local Moodle 4.0 installation with the following question.

XML ```xml test with accents Je vais [à] l'[école].

à

école

]]>
2 0.3333333 0 gapfill [] 0 0 0 0 0 0 0 à école [] gapfill 0 0 0 0 0 0 Your answer is correct.

]]>
Your answer is partially correct.

]]>
Your answer is incorrect.

]]>
```

It works fine for me, whether I enter the solutions directly (I have the à and é letters on my keyboard) or by using the so-called dead keys (e.g. ` and a or ´ and e) or by copy-pasting them from the question text.

image

marcusgreen commented 1 year ago

Stranger and stranger..

PhilippImhof commented 1 year ago

What I find very strange is the fact that ó actually appears in the XML of the question. That makes me wonder whether the problem is related to the editor. That entity should not make it into the database. If the user types ó, it should land as ó.

@mister-mori What editor are you using?

marcusgreen commented 1 year ago

The video implies it is the new TinyMCE

PhilippImhof commented 1 year ago

Sorry, I missed that. Will try with it as well.

marcusgreen commented 1 year ago

I have just installed the Polish language pack switched to Pl and re-ran, unable to reproduce...

marcusgreen commented 1 year ago

I have reproduced the error. There is something about TinyMCE, which can be illustrated by clicking the "Fillin correct responses" button and it can be seen that the value is stored as the html representation. Which raises the question as to why this doesn't happen with the core question types.

PhilippImhof commented 1 year ago

I have just installed the Polish language pack switched to Pl and re-ran, unable to reproduce...

Same for me (without Polish), but with 4.4dev and recent TinyMCE.

image

No HTML entities in the XML or the database

image
marcusgreen commented 1 year ago

image After entering with Tiny MCE, But when I enter with Atto it puts in the Unicode character ...

marcusgreen commented 1 year ago

This won't show up on the short answer question type because it doesn't use the HTML editor...

PhilippImhof commented 1 year ago

I have retried with Polish language pack and TinyMCE and I do still not get those entities. This is a very strange bug, but I suspect it is more related to TinyMCE than to this plugin.

image

PhilippImhof commented 1 year ago

Could this be related?

entity_encoding This option controls how entities/characters get processed by TinyMCE. The value can be set as shown in Encoding Types below.

https://www.tiny.cloud/docs-3x/reference/Configuration3x/Configuration3x@entity_encoding/

marcusgreen commented 1 year ago

Looks interesting, I believe it is possible to set the details of how an instance of TinyMCE works on a per element basis (possibly). It seems that TinyMCE always cleans/convert characters like ó. You can go into HTML view and key it in but it then converts it, does it do that a accented lik you posted previously?

PhilippImhof commented 1 year ago

If I enter ó in source code view, switch to normal view and back to source code again, it will transform it to ó. (Inspecting the source via the browser dev tools, I can see the conversion already happens when leaving source code view.)

However, in no case accented letters are converted to entities for me.

marcusgreen commented 1 year ago

It appears there is a fix for this in Moodle 4.1 onwards. See https://tracker.moodle.org/browse/MDL-78745 I have done a little testing and it works as expected for me. mister-mori are you able to update your Moodle to confirm this fix?

mister-mori commented 1 year ago

I suppose I am (by the way my moodle version is 4.2.2). Which version should I choose 4.3 or 4.2.3? Screenshot_2

marcusgreen commented 1 year ago

4.3 is very recent, so I am cautious and would wait for a point version to come out unless I wanted access to any of the headline new features https://openedtech.social/@moodle/111202468298089533

I suggest taking it to 4.2.3 version 2023042403

mister-mori commented 1 year ago

I've justed updated Moodle to 4.2.3. Now it works perfectly. Thank you marcusgreen, PhilippImhof.

Screenshot_1

marcusgreen commented 1 year ago

Brilliant, How can I refer to you when in the next set of release notes as someone who has helped with the quality of the question type, just as Oleksandr or a full name or an email address? The notes will appear in this file https://github.com/marcusgreen/moodle-qtype_gapfill/blob/master/changelog.md

It pleases me hugely to hear about people using my question types, especially in other languages in such an English based world.

Where are you in the world?

mister-mori commented 1 year ago

It is my pleasure to experience such a quality support.

My full name is Oleksandr Anistratenko. I am from Ukraine.

Thank you again for help and creating the plugin.

marcusgreen commented 1 year ago

Would you email me at marcusavgreen at gmail.com