Finding out the default character encoding in Windows

15

6

Is there any way to find what is the default character encoding in Windows? I know that in Western Europe and the US, CP-1252 is the default, but need to check this on other Windows machines too.

Alternatively, is there any list of default encodings per locale?

Grodriguez

Posted 2013-10-29T11:32:12.613

Reputation: 297

It is related to customer support, not programming. The control panel applet has been renamed in every Windows version. XP calls it "Regional and Language Options" iirc, Win7 calls it "Region and Language", Win8 calls it "Region". Given that you are interested in different code pages, you'll have to figure out the localized name for the applet to give the customer the correct instructions. Perhaps a little program you write yourself starts sounding attractive? – Hans Passant – 2013-11-05T19:29:43.803

The default character encoding on Windows is UTF-16. What you may be referring to is the default legacy codepage that is used for ancient non-Unicode applications and all the ANSI API functions (which honestly should never be relevant for current software, alas it sadly all too often is). – Joey – 2013-11-06T06:12:53.850

@Joey: Right. Unfortunately I have to read files which were generated by these ancient non-Unicode applications :-/ – Grodriguez – 2013-11-06T17:40:55.187

1@HansPassant: Sorry, but it is not related to customer support, it is related to programming. I don't want to give any instructions to the customer. That's the point of my question. I need my code to be able to read files generated by a non-Unicode application, and for that I need to know the default encoding based on the user's locale. – Grodriguez – 2013-11-06T17:42:22.507

Answers

20

You can check with PowerShell:

[System.Text.Encoding]::Default

which even enables you to check that across several machines at once.

Joey

Posted 2013-10-29T11:32:12.613

Reputation: 36 381