Editor removes BOM #12316

Closed
opened 2025-11-02 10:05:22 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @dsteinbe11 on GitHub (Jan 9, 2024).

Description

If a file is edited with the built-in editor, the BOM is removed after the commit.

The file is UTF-8-BOM, after the commit it´s UTF-8.

I have reproduced this issue with your demo site, see:
https://try.gitea.io/dsteinbe/editor-bom-issue

Gitea Version

1.21.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

2.40.0, Wire Protocol Version 2 Enabled

Operating System

windows

How are you running Gitea?

service

Database

SQLite

Originally created by @dsteinbe11 on GitHub (Jan 9, 2024). ### Description If a file is edited with the built-in editor, the BOM is removed after the commit. The file is UTF-8-BOM, after the commit it´s UTF-8. I have reproduced this issue with your demo site, see: https://try.gitea.io/dsteinbe/editor-bom-issue ### Gitea Version 1.21.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.40.0, Wire Protocol Version 2 Enabled ### Operating System windows ### How are you running Gitea? service ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 10:05:23 -06:00
Author
Owner

@crackedmind commented on GitHub (Jan 24, 2024):

yeh, it's annoying

@crackedmind commented on GitHub (Jan 24, 2024): yeh, it's annoying
Author
Owner

@silverwind commented on GitHub (Jan 25, 2024):

Maybe it's because we don't set the perserveBOM option on Monaco's getValue:

https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.ITextModel.html#getValue

@silverwind commented on GitHub (Jan 25, 2024): Maybe it's because we don't set the `perserveBOM` option on Monaco's `getValue`: https://microsoft.github.io/monaco-editor/typedoc/interfaces/editor.ITextModel.html#getValue
Author
Owner

@github-actions[bot] commented on GitHub (Feb 29, 2024):

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 29, 2024): Automatically locked because of our [CONTRIBUTING guidelines](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#issue-locking)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12316