WeBWorK Main Forum

unicode minus sign

unicode minus sign

by Alex Jordan -
Number of replies: 3
Recently I've had a few students complain about the following. They submit an answer and get a (to them) cryptic error message. I've sleuthed out that they are getting some answer somewhere and copy-pasting it into the answer blank instead of typing directly. And what they paste has this character in it:
https://www.fileformat.info/info/unicode/char/2212/index.htm

The UTF-8 literal for this is \xe2\x88\x92.
(https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8704&number=128&names=-&utf8=string-literal)

The message they get is like this one, sometimes slightly different depending on the characters surrounding the special minus sign:
DBD::mysql::st execute failed: Incorrect string value: '\xE2\x88\x9E, 2...' for column 'answer_string' at row 1 at /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm line 837.

Is there anything we can do about this scenario to make the user experience better? For one thing, it appears the database is just disallowing this to be saved as a submitted answer. Is it possible to change that (and perhaps change this for similar special characters)?

Second, are we at the point where we can add these characters to MathObjects to be understood as equivalent to their plain keyboard counterparts?
In reply to Alex Jordan

Re: unicode minus sign

by Nathan Wallach -
Alex -

Please open a GitHub issue.

Both aspects certainly deserve attention:
  1. The database handling such characters. (I suspect that it the string was encoded into UTF-8 it would work, but we will need to make sure encoding occurs when writing to the database, and decode when reading back from the database).
  2. It would certainly be nice to teach MathJax to recognize Unicode math operators as equivalent to their ASCII equivalents. I'm not sure how this should be best handled, and the interaction with MathJax (Answers Table, etc.) and MathQuill will need to be considered.

Please @ heads up to me, Davide, Florian, Andrew Parker and anyone else active in the UTF-8 / MathObjects / MathQuill support.

Sorry, but I suspect it may take time until it is fully solved, depending on when people can make time to address it.

Tani
In reply to Alex Jordan

Re: unicode minus sign

by Sean Fitzpatrick -
While I understand the need to address this, I have to say that I'm all right with having things blow up on the students who feel they can cheat their way through the homework by copying everything from Symbolab.
In reply to Sean Fitzpatrick

Re: unicode minus sign

by Alex Jordan -
For the minus sign and that kind of cheating, I definitely agree. I think there are at least three distinct reasons to eventually do this though. I'll mention them here for consideration.
  1. It may be that the student is just using a desktop or online calculator for some trivial part of the exercise. Like in the last step of a calculation, they want cos(2) as a decimal approximation. And they copy the minus sign from there.
  2. They want to enter the infinity symbol. And they are unaware of "inf" or "infinity". And none of the answer entry help tools are enabled. So they turn to the internet to find an infinity symbol they can copy and paste.
  3. Combat the perception that "WeBWorK is broken," that it doesn't even "understand minus signs".