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!

  • 1
    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
    Commented Aug 23, 2012 at 14:55
  • 1
    @jordanm I think the OP means that those filenames contain illegal UTF-8 sequences.
    – Mr Lister
    Commented Aug 23, 2012 at 16:06
  • @MrLister - you are correct!
    – zharvey
    Commented Aug 23, 2012 at 16:17
  • Not that I can provide a solution though...
    – Mr Lister
    Commented Aug 23, 2012 at 16:18
  • How do the files get onto the CentOS machine? You might be able to recode the file names at that point. Commented Aug 23, 2012 at 20:39

2 Answers 2


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


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"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .