stash can not view source file encoding by gbk ?

My source file include some chinese chars, and those chinese chars encoding by gbk not utf-8, when view source in stash, chinese chars not correct display,and also diff。anyone help me? thanks。

1 answer

0 votes
Bryan Turner Atlassian Team Feb 20, 2013

Smith Xin,

Stash relies on heuristics to detect the codepage for source files, when viewing source. It has been tested with GB18030-encoded files, but it appears there are other encodings that are also referred to as "GBK". The easiest way for us to help you would be for you to raise a support request at Then perhaps you can share a simple, GBK-encoded file with us so we can include it in our testing. That would at least help us get it working for viewing source.

Diffs, unfortunately, are another story. git diff internally only understands UTF-8. Any other format is viewed as binary and cannot be diffed. To diff files in other encodings, an external diff tool must be used. Stash does not do this, nor does it support it. You may want to open a new feature request on so that it can be voted on, and to keep it on our radar.

Full support for international character sets is not a current Stash feature. It is something that has been discussed, but has taken a backseat to other features like pull requests, hooks and forks. Raising an issue and voting for it helps us gauge how important the feature is to customers, and potential customers.

Sorry I can't be more help! If you do raise an issue at, or, you might reference this question there to help us link the two.

Best regards,
Bryan Turner

Bryan Turner,

Thank you very much,but as far as I know the gbk is a subset of GB18030, it should to be correct display,if any configuration i can set?

Bryan Turner Atlassian Team Feb 20, 2013

Unfortunately, no, there are no configuration settings. Stash performs its heuristic detection and, if that fails, falls back on UTF-8. As I noted, international character sets are not a feature of the current system. They're best-effort detection.

If you're willing to attach a file in your encoding (you can even attach one to this Answers question), I'll take a look and see if I can at least get the detection on the source view to work. If so, I'll try to get my fixes for that included in 2.2.

Best regards,
Bryan Turner

Bryan Turner,

Thansks, when I prepaire the sample file encoding by gbk ,I found the (README.txt) can display well,but the README-gbk.txt not ,It's only a line. why?

attach (README-gbk.txt) for up .

Bryan Turner,

Thank you for your help, I understand the file must have enough chars to to detect the codepage for source file,It should be work in most of files。 thank you very much !

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder :  #!/bin/bash source "$(dirname "$0")/" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

314 views 0 12
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you