## WeBWorK Problems

### Grader feedback to Essay problems causes Webwork Error page

by tim Payer -
Number of replies: 2

Greeting folks,

I have encountered a bug of sorts in the Essay problem sets: (PGessaymacros.pl)

Let me explain the context:

1.) I encouraged students to use LaTeX entry in their essay answers to display the greek letters of mu and alpha, aka:  $$\mu$$ and $$\alpha$$.

2.) About 10% of my students opted to create these expressions in other faulty ways: that is they copy and pasted the images of mu and alpha from the web or symbol tablets, or used ALT + 981, or ALT + 224.

3.) These efforts of course resulted in very strange characters which I will NOT copy and paste here as this is the beginning of the glitch.  But I am entering a LaTeX version of what one of these images looked like:  $$\hat I \small{1/4}d$$ instead of $$\mu_d$$ there are many more variations that can't be simulated by LaTeX.

4.) So far, this is NOT the bug, just the background of how the bug gets it start. The bug comes into play when the grader, namely, me here, decides to copy and paste these images into the comment section for the student's feedback on their Essay submission. I wanted the students to see that the image that they thought would render mu or alpha is in fact a jumbled gibberish of odd characters. And can you dear student see that the copy and paste method will render something quite different than your intent. And could you please stop doing so.

5.) I save my comments in webwork after every two or three student papers. After a half-dozen saves (15-20 students) I am directed to the "Webwork Error" page and none of my recent work was saved. It was only after an hour transferring these written comments to a file for later distribution that I discovered the glitch: Those students that had their copy and pasted characters pasted into their comment feedback had hundreds and hundreds of said characters. They were replicating exponentially with every save of the comment page.

6.)  Deleting all instances of these errant characters fixed the problem.

7.)  Just a heads up here that the same potential problem is waiting for folks using an LTI file to enable grade-passback between webwork and their LMS. It is the copyright symbol, The Capital "C" within a circle, that is the errant character here. Yes, keep the word "copyright" in place in the LTI file you are using, but delete the circumscribed C. And do not think that because it is behind a commented ## statement that it goes unnoticed. When you save your LTI file more than a few times that circumscribed C character will generate many symbols that look like $$\tilde A$$.  Saving the LTI file a number of times is what one does when testing the connection of the LTI, After so many saves your attempt to access the LTI file in the file manager will be met with the pink letters:  "This does not appear to be a text file". And then you can't access the LTI file. Keep a fresh copy on file, or just delete the circumscribed C.

### Re: Grader feedback to Essay problems causes Webwork Error page

by Nathan Wallach -
Tim -

If I recall, Latin-1 has "A tilde" in the region of 8-bit encoding which UTF-8 use to start multi-byte characters.

The issue you are reporting sounds to me like the special character (ex. copyright symbol or the special math symbols students submitted) are being handled as / converted to an (or a sequence of) 8-bit character(s) rather than a UTF-8 character somewhere in the processing stream, and then later "read" as UTF-8 even thought the data was not properly saved as UTF-8.

I do not know if the "essay" support was checked with UTF-8 for proper behavior as the UTF-8 support was added to WeBWorK. Based on your report, I suspect that it was not.

Mike and I ran into an issue back in 2019 with an early version of the UTF-8 support, when "text mode" file update would mangle some uploaded UTF-8 files, while the same files uploaded properly in "binary" mode. If I recall correctly, in text mode, the save files did not match the original files, and when the file was loaded, under the assumption that it would be UTF-8, it would get mangled. I'm pretty sure Mike had made a fix which fixed that issue regarding file uploads well before WW 2.15 was released.

However, now that WW assumes that files are typically in UTF-8, uploading some old 8-bit encoding files (ex. with the Latin-1 copyright symbol) in binary mode could very likely trigger a situation where the file would be saved as an 8-bit Latin-1 file on the server and the read by the server as UTF-8 file, leading to mangling of the file. It would be helpful to understand (a) when version of WW you are running, (b) what "LTI file" you are discussing. and (c) exactly how you are editing/saving the file to trigger the creation of all these "A tilde" characters. Then hopefully, we can open an issue on GitHub and eventually also fix the issue.

### Re: Grader feedback to Essay problems causes Webwork Error page

by tim Payer -
Thanks Nathan,

a.) I neglected to mention that we are using a subscription of Webwork from the MAA, which means these problems might be unique to version 2.13, which is all that is available for Subscription users.

b.) I have attached copy of an "LTI" file, which I should have described as a course.conf file that has LTI enabled connections. I kept the errant circumscribed C in the code block. I also Changed the Consumer secret out of an abundance of caution to \$LTIBasicConsumerSecret = "changed"; but note that even this small change introduced more errant characters next to the circumscribed C at the top of the document.

c.) The exact editing and saving of the course.conf file that prompts the creation of these errant characters is all within the File Manager, here is what I just did to reproduce the glitch.

1.) I open the File manager in my Webwork course.
2.) I click on the up arrow at the top of the dialogue box to leave the templates directory and enter the course directory.
3.) I click on a version of a course.conf file called TimS109_course.conf to select it from within the course directory.
4.) I click on the edit button from the column of button options on the right.
5.) From within this text file of course.conf I change the old Consumer secret to that of "changed".
6.) I press the save button.
7.) I click the updated TimS109_course.conf in the course directory to select it.
8.) I click on the View button and witness the propagation of errant characters next to culprit of the circumscribed C at the top of the code block.

Best, Tim