Sublime Forum

Please help me....terminal is not printing Korean

#1

I was input string and printing of use Korean…

terminal is not printing Korean…

but english is printing…

Help me…T.T

0 Likes

#2

This (and your other issue) is because of encodings’ mismatch. Sublime expects utf-8 while programs (Python in this case) generate output in system’s one-byte encoding.

Let’s try to fix it for Python:

  1. Find Python.sublime-package in <executable_path>/Packages. It’s a zip archive, you need to extract Python.sublime-build from it.
  2. Create Python in <data_path>/Packages and copy Python.sublime-build to it. Now Sublime will use this version of file instead of the one from package.
  3. Add a new key encoding with you system encoding. Should be something like this:
{
    "cmd": ["python", "-u", "$file"],
    "file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python",
    "encoding": "<your_system_encoding>",

...skipped...
}

To figure out the encoding you need run this python script in Sublime:

import sys
print(sys.stdout.encoding)
0 Likes

#3

Step 1 and 2 can be combined and simplified by using the PackageResourceViewer package.

cp1252 is a western codepage and does not include korean. It appears that cp949 is the default codepage on Korean Windows systems.

However, what I suggest instead is to change Python’s output to use utf-8 by setting the $PYTHONIOENCODING environment variable as described here:

0 Likes

#4

Well, I’ve mentioned how to get the system codepage… Anyway, @jps needs to patch exec.py in Default package and fall back to sys.stdout.encoding instead of utf-8. It will fix the issue.

0 Likes

#5

thank you that you give me your time…

I changed “Python.sublime-build” how you said to me…

but when i print(sys.stdout.encoding)

output is “cp949”

I’m using Anaconda that include python 3.5…I think it is problem…

do you have another idea…?

I request to help again…

have a good day lastsecondsave!

0 Likes

#6

You need to put your encoding in the file, not to use the one from sample. But I agree with @FichteFoll, check the link he provided for a better solution.

0 Likes