Skip to content

500 Internal Error when jury view code with non-UTF-8 encoding code. #3217

@cubercsl

Description

@cubercsl

Description of the problem

Jury can not view code with non-UTF-8 encoding code (and diff with it)

The string to escape is not a valid UTF-8 string in "jury/partials/submission_diff.html.twig" at line 72.

Your environment

  • DOMjudge version 9.0 or later (with Monaco Editor)
  • Debian 13
  • Nginx

Steps to reproduce

  1. Team or jury submit a code with non-UTF-8 encoded source code. (This may happen in some local contest, some team may type some non-ascii character in their source code)
  2. Jury view the code.

Expected behaviour

It should be shown either in the correct encoding or force display in UTF-8 encoding.
At the very least, it shouldn't be a 500 error; the code can't be displayed at all.

Actual behaviour

Jury can view the code.

Any other information that you want to share?

I have repro this in demoweb now. See https://www.domjudge.org/demoweb/jury/submissions/9677/source
It is also happened in our last weekend ICPC Regional Contest (only one jury test submission with Chinese GBK-encoded comment in his code and submit from his Windows laptop), and I have a db-dump.
If more information is needed, I can provide it via slack DM.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions