NAME

Encode::Locale - Determine the locale encoding

SYNOPSIS

use Encode::Locale;
use Encode;

$string = decode(locale => $octets);

binmode(STDIN, ":encoding(locale)");
binmode(STDOUT, ":encoding(locale)");

DESCRIPTION

Perl uses Unicode to represent strings internally but many of the interfaces it has to the outside world is still byte based. Programs therefore needs to decode strings that enter the program from the outside and encode them again on the way out.

The POSIX locale system is used to specify both the language conventions to use and the prefered character set to consume and output. This module looks up the charset (called a CODESET in the locale jargon) and arrange for the Encode module to know this encoding under the name "locale".

In addition the following functions and variables are provided:

decode_argv()

This will decode the command line arguments to perl (the @ARGV array) in-place.

env( $key )
env( $key => $value )

Interface to get/set environment variables. Returns Unicode string and the $key and $value arguments are expected to be the same. Passing undef as $value deletes the variable named $key.

$ENCODING_LOCALE

The encoding name determined to be suitable for the current locale. Encode know this encoding as "locale".

$ENCODING_FS

The encoding name determined to be suiteable for file system interfaces involving file names. Encode know this encoding as "locale_fs".

$ENCODING_CONSOLE_IN
$ENCODING_CONSOLE_OUT

The encodings to be used for reading and writing output to the a console. Encode know these encodings as "console_in" and "console_out".

SEE ALSO

I18N::Langinfo, Encode

AUTHOR

Copyright 2010 Gisle Aas <gisle@aas.no>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.