On May 10, 2020, at 03:47, Ned Batchelder
On 5/10/20 3:09 AM, Steve Barnes wrote:
Change the error message “SyntaxError: invalid character in identifier” to include which character and it’s Unicode value so that it becomes “SyntaxError: invalid character 0x201c “ in identifier” – this is almost certainly the easiest change and fits well with explicit is better than implicit but still leaves it to the user to correct the erroneous input (which could be argued is both good and bad).
Or change it to, "SyntaxError, only plain quotes can be used: you have 0x201c which is a fancy quote" (or something). We have a specific SyntaxError message for print-without-parens, we should be able to do this also.
Can the error message actually include the Unicode character itself? A novice isn’t going to know what U+201c means, they may not be entirely sure what fancy quote means or how to search for it, but they will know what “ means and can search for it by just copying and pasting from the error message to the Find box in their editor. (I think we do include Unicode characters in other error messages when they come directly from the user’s input text. For example, if I try to 2+Spám(), the error message will have á in the string.)