Q:

Sublime - Python3 not printing non utf-8 characters (Spanish)

I think it's sublime related rather than python, running this snippet:
x = "Buenos días"
print(x)

will print in terminal/command prompt but not in sublimes build results. Did already a little bit of research but couldn't find a working solution. Removing the í acute accent to a i works as expected.

A:

Generally speaking problems like this are caused by some interplay between how Python determines behind the scenes the encoding that it should use when it's generating output and how Sublime is executing the Python interpreter.
In particular where it may correctly determine the correct encoding when run from a terminal, the Python interpreter may get confused and pick the wrong one when Sublime invokes it.
The PYTHONIOENCODING environment variable can be used to tell the interpreter to use a specific encoding in favor of whatever it might have otherwise automatically selected.
The sublime-build file lets you specify custom environment variables to apply during a build using the env key, so you can do something like the following:
{
    "shell_cmd": "python -u \"$file\"",
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",

    "env": {"PYTHONIOENCODING": "utf-8"},

    "variants":
    [
        {
            "name": "Syntax Check",
            "shell_cmd": "python -m py_compile \"${file}\"",
        }
    ]
}

