developer
developer

Reputation: 99

what is the default encoding for perl 5.16.3

like xml uses UTF-8 as default encoding. suppose no pragma like use encoding, use Encode and use utf-8 etc haven't define in perl script, then in this case what would be default encoding perl uses. perl version is 5.16.3

Upvotes: 1

Views: 938

Answers (1)

ikegami
ikegami

Reputation: 385897

The source code is expected to be encoded using an ASCII-based encoding. Non-ASCII characters (80..FF) will be considered non-word characters. String and regex literals that contain these characters will result in strings and regex patterns with the same character.

For example, if you have a file encoded with cp1252,

my $s = "Éric";   # Assigns the cp1252-encoding of `Éric` to `$s`.

For example, if you have a file encoded with UTF-8,

my $s = "Éric";   # Assigns the UTF-8-encoding of `Éric` to `$s`.

Upvotes: 1

Related Questions