This could work like this:
CREATE DATABASE dbname ENCODING 'win1251'
lc_ctype='ru_RU.CP1251'
lc_collate='ru_RU.CP1251'
TEMPLATE template0;
If the ru_RU.CP1251 locale doesn't exist, create it with sudo locale-gen ru_RU.CP1251 (Ubuntu-style, I assume Mint is similar in this regard) and restart postgres (it doesn't pick up new locales dynamically, and the error message is confusing).
The postgistemplate db would be accepted as a template only if it has the same encoding, which is unlikely given the context. Presumably it's in UTF-8.
In this case, there are two options in theory, not sure if any is practical:
- create the database with
template0 as mentioned in the command above, and then play the postgis initialization script inside it.
- recreate the
postgistemplate database in win1251 encoding assuming it's supported by postgis.
Personally, I'd try to solve the problems with UTF-8 that led you to try a different encoding in the first place, and stay with that encoding.