I'm using Vim, installed from the Arch Linux repo.

I've tried adding set fileencodings=utf-8 and set encoding=utf-8. I've tried with all caps (UTF instead of utf) and putting it in /etc/vimrc and ~/.vimrc.

More over, I tried writing a file as UTF-8 using :write ++enc=utf-8 but that didn't work either.

I'm testing the files with file test and it keeps telling me it's ASCII text. This is a problem since I use non-ASCII characters.

1 Answer 1


I feel like an idiot. The test file doesn't have any non-ASCII characters in it, so there is nothing for file to look for that would tell it the encoding Vim is using. So I repeated the test with ä in it and it returns "utf-8" as desired.

In short, file was doing its best, and Vim was doing what I wanted it to do.

  • file doesnt always do so well, anyways. You can trick its heuristics, iirc
    – D. Ben Knoble
    Nov 30, 2018 at 4:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.