Non-Unicode Perforce Servers
A Perforce server can run in either Unicode or non-Unicode mode.
A new installation defaults to non-Unicode mode, and switching to Unicode mode after the server has been in use for a long time is not easy.
Set up a server for Unicode | P4 Server Administration Documentation (2025.1)
So, if you use characters outside the English alphabet, such as Korean characters,
it's generally safer to configure a new Perforce server in Unicode mode from the start.
p4python
In addition to the P4V GUI and the p4 command-line client,
Perforce provides APIs for using its features from various languages, including C/C++, C#, and Python.
P4Python is the Python API, provided as a Python wrapper around the C++ API.
Home | P4 API for Python Documentation (2025.1)
You can use this API to access p4 functionality from Python, as shown below.
from P4 import P4, P4Exception
p4 = P4()
p4.port = "127.0.0.1:1666"
p4.user = "HAPPY"
p4.client = "HAPPY_test"
try:
p4.connect()
result = p4.run("fstat", "//...")
print(result)
p4.disconnect()
except P4Exception:
for e in p4.errors:
print(e)
The Configuration That Caused the Problem
Server
OS: Windows Server
Locale: ko; Korean (Unicode UTF-8 support disabled)
Non-Unicode mode
Client
OS: Windows 10
Locale: ko; Korean (Unicode UTF-8 support disabled)
Encoding Issues
When files with Korean characters in their paths are uploaded to a non-Unicode server and processed with P4Python, the output can become garbled or commands can fail.

You can resolve this by specifying the encoding as shown below.
p4 = P4()
p4.port = "127.0.0.1:1666"
p4.user = "HAPPY"
p4.client = "HAPPY_test"
p4.encoding = 'cp949' # Specify the encoding

The official documentation only briefly explains that you should specify the encoding used to receive strings from a non-Unicode server:
Encoding to use when receiving strings from a non-Unicode server. If unset, use UTF8.
Can be set to a legal Python encoding, or to `raw` to receive Python bytes instead of Unicode strings. Requires Python 3.
Another Issue
I didn't document the exact case, so I couldn't find it again,
but there were instances where commands failed even with the encoding specified.
Since the same commands worked with the p4 command-line client, I also used a wrapper that runs p4 commands.
Output-formatting options such as -Ztag make parsing the output a little less tedious.
Formatting P4 command output using the -F global option with examples