Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Is there a variable or function that returns the native platform encoding (APR_LOCALE_CHARSET)

by ELISHEVA (Prior)
on Feb 01, 2009 at 13:56 UTC ( #740533=perlquestion: print w/replies, xml ) Need Help??
ELISHEVA has asked for the wisdom of the Perl Monks concerning the following question:

In the subversion C/C++ API one of the function parameters defaults to a "locale encoding" which apparently is the native encoding used by the platform where the subversion client is running. I've been trying to find out how to use Perl to tell me the "locale" encoding and I'm having no luck. I'm sure I'm just not looking in the right place, but I wonder if one of the esteemed monks would be willing to tell me where this little tidbit is hiding.

So far I have tried:

Many thanks in advance, beth

Note: the subversion perl API does have such a function, called svn_locale_charset(), located in core.i. I'm interested in a pure Perl equivalent.

Note2:The ideal would be platform independent (works on all Perl supported systems), but a stop-gap would be a collection of OS-specific functions that I could wrap together with some OS detection code.

  • Comment on Is there a variable or function that returns the native platform encoding (APR_LOCALE_CHARSET)

Replies are listed 'Best First'.
Re: Is there a variable or function equivalent to APR_LOCALE_CHARSET (native platform encoding)
by cdarke (Prior) on Feb 01, 2009 at 14:10 UTC
    POSIX::setlocale, which not only sets, but can also query the locale.

      That's the locale, which isn't quite the same thing as the IANA name of the character set (I think). How do I get from the return value of setlocale(...) to the encoding? POSIX::localeconv(..) only gives me numeric formatting conventions.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://740533]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2017-03-26 07:51 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (313 votes). Check out past polls.