Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve BOM in web editor (#28935) #28959

Merged
merged 1 commit into from
Jan 27, 2024

Commits on Jan 27, 2024

  1. Preserve BOM in web editor (go-gitea#28935)

    The `ToUTF8*` functions were stripping BOM, while BOM is actually valid
    in UTF8, so the stripping must be optional depending on use case. This
    does:
    
    - Add a options struct to all `ToUTF8*` functions, that by default will
    strip BOM to preserve existing behaviour
    - Remove `ToUTF8` function, it was dead code
    - Rename `ToUTF8WithErr` to `ToUTF8`
    - Preserve BOM in Monaco Editor
    - Remove a unnecessary newline in the textarea value. Browsers did
    ignore it, it seems but it's better not to rely on this behaviour.
    
    Fixes: go-gitea#28743
    Related: go-gitea#6716 which seems to
    have once introduced a mechanism that strips and re-adds the BOM, but
    from what I can tell, this mechanism was removed at some point after
    that PR.
    silverwind authored and GiteaBot committed Jan 27, 2024
    Configuration menu
    Copy the full SHA
    95fee4a View commit details
    Browse the repository at this point in the history