Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

We have a CentOS backend running server software that is processing files generated by our clients. Many of our clients are Windows users, and generate these files on their Windows machines in the CP-1252 (aka "Win-1252") character encoding.

Occasionally, when processing these files, we get one that has a CP-1252 character in the file name, and this causing our server code to choke (and throw runtime exceptions). We could implement a code solution where we read files (and their names) in as pure binary and then apply the correct character encoding to them, however if there is an easier (systems-level) fix that doesn't involve coding effort and a new release, that would be optimal.

So I ask: is it possible to add CP-1252 support for CentOS machines? Thanks in advance!

share|improve this question
The only characters that are invalid for a filename in *nix is '/' and '\0'. If your code doesn't handle it all, the code is broken. – jordanm Aug 23 '12 at 14:55
@jordanm I think the OP means that those filenames contain illegal UTF-8 sequences. – Mr Lister Aug 23 '12 at 16:06
@MrLister - you are correct! – zharvey Aug 23 '12 at 16:17
Not that I can provide a solution though... – Mr Lister Aug 23 '12 at 16:18
How do the files get onto the CentOS machine? You might be able to recode the file names at that point. – Gilles Aug 23 '12 at 20:39
up vote 2 down vote accepted

This is generally something you will have to manage in your software. Filenames in Unix are already treated as binary; as jordanm mentioned earlier, only '/' and '\0' are disallowed characters. See the answers to this question for more info: Several questions about file-system character encoding on linux

share|improve this answer

Did adding the following to your environment for your Java backend have any effect on the problem you reported in How to add cp 1252 to centos on Superuser:

export LC_ALL="en_US.ISO-8859-1"
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.