Specify Charset for Unrar Terminal Output
This guide explains how to configure unrar to output
text using a specific character set in your terminal. When extracting or
listing archives containing non-ASCII filenames, foreign alphabets, or
special symbols, configuring the output encoding prevents garbled
characters, question marks, and terminal display errors. Below is the
precise syntax and usage examples for controlling console output
encoding using the native unrar command-line switches.
Syntax Overview
To set a specific character set for terminal output, use the
-sc switch appended with the character set identifier and
the display target specifier (d):
unrar <command> -sc<charset>d <archive.rar>Parameter Breakdown
The -sc switch accepts two components to control console
display:
Charset Identifiers:
u: Unicode (UTF-8)a: ANSI (standard Windows code page or local 8-bit encoding)o: OEM (DOS/legacy console encoding)
Target Specifier:
d: Display (directs the encoding choice specifically to terminal and console output)
Practical Examples
1. Set Terminal Output to UTF-8
To view archive contents in standard UTF-8 encoding (most modern Linux and macOS terminals):
unrar l -scud archive.rar2. Set Terminal Output to OEM
If you are running unrar on older Windows Command Prompt
environments that rely on OEM codepages:
unrar v -scod archive.rar3. Set Terminal Output to ANSI
To force output matching the ANSI standard:
unrar l -scad archive.rarCombining Targets
The -sc switch allows combining targets if you also want
to apply the same character set to comments (c) or list
files (l) simultaneously:
- UTF-8 for both console display and archive
comments:
unrar v -scucd archive.rar - UTF-8 across display, comments, and list files:
(Omitting the target letter applies the chosen charset globally to all operations).
unrar x -scu archive.rar