Skip to content
Snippets Groups Projects
Commit ae384382 authored by Guillaume ROUSSE's avatar Guillaume ROUSSE
Browse files

drop useless calls to Encode::encode

According to its documentation, all strings returned by XML::LibXML are
already utf8-encoded
parent 665bfa90
No related branches found
No related tags found
No related merge requests found
......@@ -6,8 +6,6 @@ use warnings;
use English qw(-no_match_vars);
use XML::LibXML qw(:libxml);
use IdPAccountManager::Tools;
sub new {
my ($pkg, %args) = @_;
......@@ -112,14 +110,9 @@ sub parse {
## Requested attributes information
push @{ $data->{requested_attribute} },
{
'friendly_name' =>
IdPAccountManager::Tools::encode_utf8(
$attribute->getAttribute('FriendlyName')
),
'name' => IdPAccountManager::Tools::encode_utf8(
$attribute->getAttribute('Name')
),
'is_required' => _boolean2integer(
'friendly_name' => $attribute->getAttribute('FriendlyName'),
'name' => $attribute->getAttribute('Name'),
'is_required' => _boolean2integer(
$attribute->getAttribute('isRequired')
)
};
......@@ -143,10 +136,8 @@ sub parse {
)
{
if ($registrationpolicy->getAttribute('lang') eq 'en') {
$data->{registration_info}
{registration_policy} =
IdPAccountManager::Tools::encode_utf8(
$registrationpolicy->textContent());
$data->{registration_info}->{registration_policy} =
$registrationpolicy->textContent();
}
}
}
......@@ -156,8 +147,7 @@ sub parse {
if (defined $contact_details{type}) {
foreach my $contact_child ($child->childNodes()) {
$contact_details{ $contact_child->localName } =
IdPAccountManager::Tools::encode_utf8(
$contact_child->textContent());
$contact_child->textContent();
}
push @{ $data->{contacts} }, \%contact_details;
}
......@@ -167,10 +157,8 @@ sub parse {
my $displayname ($child->getElementsByLocalName('DisplayName'))
{
$data->{display_name}
{ $displayname->getAttribute('xml:lang') } =
IdPAccountManager::Tools::encode_utf8(
$displayname->textContent());
$data->{display_name}->{ $displayname->getAttribute('xml:lang') } =
$displayname->textContent();
## Set a default displayName in case no English version is provided
## However there is no way to determine the native displayName
......@@ -178,9 +166,7 @@ sub parse {
if ( !$data->{default_display_name}
|| $displayname->getAttribute('xml:lang'))
{
$data->{default_display_name} =
IdPAccountManager::Tools::encode_utf8(
$displayname->textContent());
$data->{default_display_name} = $displayname->textContent();
}
}
......@@ -189,10 +175,8 @@ sub parse {
my $description ($child->getElementsByLocalName('Description'))
{
$data->{description}
{ $description->getAttribute('xml:lang') } =
IdPAccountManager::Tools::encode_utf8(
$description->textContent());
$data->{description}->{ $description->getAttribute('xml:lang') } =
$description->textContent();
}
foreach
......@@ -204,8 +188,7 @@ sub parse {
$contact->getAttribute('contactType');
foreach my $contact_child ($EntityDescriptor->childNodes()) {
$contact_details{ $contact_child->localName } =
IdPAccountManager::Tools::encode_utf8(
$contact_child->textContent());
$contact_child->textContent();
}
push @{ $data->{contacts} }, \%contact_details;
}
......@@ -213,15 +196,13 @@ sub parse {
foreach my $sso (
$child->getElementsByLocalName('OrganizationDisplayName'))
{
$data->{organization} =
IdPAccountManager::Tools::encode_utf8($sso->textContent());
$data->{organization} = $sso->textContent();
}
## Getting X.509 certificates
foreach my $cert ($child->getElementsByLocalName('X509Certificate'))
{
$data->{certificate} =
IdPAccountManager::Tools::encode_utf8($cert->textContent());
$data->{certificate} = $cert->textContent();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment