You are here

public function TextEncoder::convertEncoding in Feeds extensible parsers 8

Converts a string to UTF-8.

Parameters

string $data: The string to convert.

Return value

string The encoded string, or the original string if encoding failed.

Overrides EncoderInterface::convertEncoding

1 method overrides TextEncoder::convertEncoding()
XmlEncoder::convertEncoding in src/Encoder/XmlEncoder.php
Converts a string to UTF-8.

File

src/Encoder/TextEncoder.php, line 45

Class

TextEncoder
Generic text encoder.

Namespace

Drupal\feeds_ex\Encoder

Code

public function convertEncoding($data) {
  if (!($detected = $this
    ->detectEncoding($data))) {
    return $data;
  }
  return $this
    ->doConvert($data, $detected);
}