Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Win32 FileSystem codepage

by Khariton (Sexton)
on Dec 06, 2010 at 20:16 UTC ( #875686=perlquestion: print w/ replies, xml ) Need Help??
Khariton has asked for the wisdom of the Perl Monks concerning the following question:

How I can get information about filesystem codepage in Win32?
For example, in Windows with cyrylic MUI, system use cp1251 codepage for filesystem.
For working with international file- and pathnames I need know about codepage of filesystem.
My program use UTF-8 for internal working(Tk and other...) and I must encode names from filesystem codepage to internal UTF-8. I use utf-8 in Linux , but in Win32 I must using a lot of codepages for work with international filenames...

Comment on Win32 FileSystem codepage
Re: Win32 FileSystem codepage
by ikegami (Pope) on Dec 06, 2010 at 20:37 UTC
    • Windows:

      You can obtain the ANSI code page using GetACP. It's trivial to write Win32::API glue for that function.

      For existing files, you can use Win32::GetANSIPathName.

    • Unix:

      open's ":locale" uses the following to determine the appropriate encoding:

      require encoding; $locale_encoding = encoding::_get_locale_encoding();

    I don't know if anyone got around to making this usable.

Re: Win32 FileSystem codepage
by SimonClinch (Chaplain) on Dec 09, 2010 at 00:37 UTC
    You could use Win32::CodePage and/or Win32::Locale

    One world, one people

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://875686]
Approved by ww
Front-paged by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-04-25 09:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (586 votes), past polls