jsor
jsor

Reputation: 97

How can I specify the WE8MSWIN1252 encoding in Perl?

I am using Perl and want to encode my strings using the following encoding : WE8MSWIN1252

I tried

$output =encode('WE8MSWIN1252',$string)

but its throwing error .

any idea how to specifiy this encoding WE8MSWIN1252 ?

Upvotes: 1

Views: 127

Answers (1)

ikegami
ikegami

Reputation: 385897

WE8MSWIN1252 is Oracle's designation for Windows-1252.

use Encode qw( encode );

my $bytes = encode('Windows-1252', $ucp);    # aka 'cp-1252' aka 'cp1252'

$ucp is expected to be decoded text aka a string of Unicode Code Points.

Upvotes: 3

Related Questions