Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Failed to detect original file encoding. Cannot save commit with unknown encoding

Ahmad Jamal
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 18, 2023

Hi

Why I get error for edit file?

Failed to detect original file encoding. Cannot save commit with unknown encoding

1 answer

1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 19, 2023

Hello @Hossein Ali Reza Asgari and welcome to the community!

This is usually caused when you copy/paste the filename which might bring some invalid UTF-8 characters causing the encoding error. If that is the case, you can try manually typing the name of the file instead and see if the error persists.

Another alternative is to clone the repository locally, make the changes to the file locally, and then push the changes back to Bitbucket Cloud.

Thank you, @Hossein Ali Reza Asgari !

Patrik S

Gilbert ALBANIS
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 21, 2024

I had the same problem, but I didn’t copy-and-paste the file name. The file name was:

main.c 

Very standard name. I don’t understand what the problem is. Please help. 

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 22, 2024

Hi Gilbert,

What is the encoding of this file? Bitbucket tries to guess a file's encoding and, when it fails, issues like this may arise.

We have a feature request for the ability to specify a repository's encoding:

In the meantime, you can edit the file locally, commit and push to Bitbucket.

I would also suggest using UTF-8 encoding for files, if possible.

Kind regards,
Theodora

Like # people like this
Michelle Richmond
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 20, 2024

I am seeing this error on a file whose original encoding is ANSI with PC line endings.

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 22, 2024

Hello @Michelle Richmond ,

Could you try to edit the file locally, commit and push and check if the error persists?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events