Skip to content

How to change encoding for an already opened file? #2981

Discussion options

You must be logged in to vote

You can change the encoding with a command like set encoding utf-16le (to change the global setting) or setlocal encoding utf-8 (to change the setting for current buffer). I think the only times micro uses the encoding is when opening or saving a file – it won't automatically re-interpret the current file with the selected encoding. If you want to do that you can set up a keybinding that runs two commands sequentially:

$HOME/.config/micro/bindings.json:

{
    "<Alt-e><c>": "command:setlocal encoding utf-8,command:reopen"
}

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by anton-kaidalov
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants