Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't myself know how deep this question actually goes (for example, for all I know there could be several, depending on my task).

Particularly, I am interested in what kinds of strings are used to name files and folders on the system.

I am also interested in how strings are represented by default for a bash or python script.

share|improve this question
That's a good question especially if you converted from Windows and contribute source code to some version control system. After switching to Ubuntu you may suddenly experience unreadable special characters, because Windows typically doesn't use UTF-8. – Bananeweizen Aug 29 '10 at 14:35
up vote 2 down vote accepted
  • Encoding of filenames on the filesystem is utf-8.
  • Bash thinks in bytes, not with strings-with-encoding-knowledge. So no default encoding. gnome-terminal's default encoding is utf-8
  • Python's default encoding is ascii
share|improve this answer
Python 3 (I think?) is changing to unicode strings by default. – Broam Aug 30 '10 at 14:32
Python 3's str() type is a unicode object in UCS-2 or UCS-4 encoding internally. How data is read or written from e.g. files and stdin is to be determined by the application/library developer, with utf-8 being standard (e.g. print(some_str) will print a utf-8 representation). – Dennis Kaarsemaker Aug 30 '10 at 20:07
Python 3 will go unicode like Ruby 1.9 Python 2 and less, like Ruby 1.8 and less are ascii-based and work with all charsets, but their idea about character count for unicode strings is wrong. (which usually isn't a problem) – Ralf Sep 6 '10 at 18:28
gnome-terminal doesn't default to utf-8; it just uses whatever your locale is set to. (As I discovered the hard way recently.) – frabjous Jan 3 '11 at 16:37
@DennisKaarsemaker No, Python3 does not leave encoding to the developer only and uses a default of UTF-8. Stdin and -out for example use the encoding of the environment by default! – Robert Siemer Oct 31 '14 at 16:25

The default character encoding is UTF-8 (Unicode), though almost all (quite possibly all on a default install) file names are regular ASCII characters, common to most encodings.

I don't know what you mean by "how many strings are represented by a bash or python script". You can use Unicode characters in bash scripts on Ubuntu, but usually with a bash script, you call other programs, and whether those other programs will handle them is another matter. It's certainly possible to do so with Python too, though you'll want to familiarize yourself with the packages and settings related thereto.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.