This file contains ambiguous Unicode characters!

If I put a UTF-8 text file with curly quotes in it, the user gets a warning “This file contains ambiguous Unicode characters! This file contains ambiguous Unicode characters that may be confused with others in your current locale.”

They aren’t ambiguous, but gitea decides they are based on its ambiguous.go code, using mapping in ambiguous.json. It considers 8217 (a back curly single quote) to be ambiguous to 96 (a backtick). This is a showstopper if I want to save a text file with curly quotes in gitea.

My test project to see the warning is here:
http://asylumcs.net:3000/rfrank/70051/src/branch/main/70051.txt

Can this warning be disabled? I can’t find anything in the config file. Thank you.

There is no configuration option that I know of, but you can override the view_file.tmpl template (see this line, note this is version 1.20’s template) and remove the elements that show the warning. You may have to update your custom template every major release, depending on what changes were made.

For how to override the template, see Customizing Gitea pages and resources.

Thank you Jake. I’ll explore that solution. It does seem strange that the default effectively blocks users from saving something without warnings as common as the text of a book with “curly” quotes. And as implemented, there is no way to hide the warning (the ESC key does nothing). Anyway thanks for the leads into the code.