Dear all,
I am reaching out with an issue I have been unable to resolve on my own, the problem I believe boils down to an issue with JSXgraph and encodings.
In its simplest form I created short answer question (I started with a formula type question but the problem applies to question types provided by the default Moodle installation). As advised on JSXgraph page using Plain Text Editor with HTML format I created three tags: <p></p> <p></p> <jsxgraph></jsxgraph> as the question text (the rest is not important). The first tag contains (three) letters from the English alphabet, the second contains a single letter from either the Cyrillic or Turkish alphabet, the last one is a copy paste from the jsxgraph examples where a simple board is created. When I preview the question I obtain the following error
Exception - DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
when I remove the second paragraph (containing non-english symbols) the question renders the expected jsxgraph board.
If from the administrator interface I change the JSXgraph plugin (Coding between tags->convert encoding) to "No" and bring back the Cyrillic paragraph, the page renders the correct JSXgraph but the Cyrillic texts is not properly displayed, similar to the errors described in the following post
https://moodle.org/mod/forum/discuss.php?d=241878
I cannot apply the solution described in the above post ( it is from 2013 and jsxgraph/filter.php does not contain such line). I am using
Moodle 4.5.3+ Build 20250321 and JSXgraph v1.10.1 - additions (2025-02-26)
This ticket
https://github.com/jsxgraph/moodle-filter_jsxgraph/issues/48
appears to be a related issue but the solution there did not apply as well. The following post
leads me to believe the issue is somewhere on how information is passed to and from the jsxgraph filter.
On the server I have multiple formula-type questions that are either in Turkish or Bulgarian and for those questions everything renders as expected. I see this issue only when including a JSXgraph tag, hence I do not believe it is an issue with how the operating system is set.
If it helps: for some of my formula type questions I experienced a correct behavior when the jsxgraph tag is the last tag in the question text (correct rendering of Cyrillic and graph). Should there be any tags after the graph I receive the above error.
I will appreciate any assistance!