You are here

public function FeedsExTextEncoder::convertEncoding in Feeds extensible parsers 7

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 FeedsExEncoderInterface::convertEncoding

1 method overrides FeedsExTextEncoder::convertEncoding()
FeedsExXmlEncoder::convertEncoding in src/Xml/Utility.php
Converts a string to UTF-8.

File

src/Text/Utility.php, line 92
Contains FeedsExEncoderInterface and FeedsExTextEncoder.

Class

FeedsExTextEncoder
Generic text encoder.

Code

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