WC_Product_CSV_Importer::adjust_character_encoding │ private │ WC 1.0

Convert a string from the input encoding to UTF-8.

Метод класса: WC_Product_CSV_Importer{}

Хуков нет.

Возвращает

string. The converted string.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->adjust_character_encoding( $value );
$value(строка) (обязательный)
The string to convert.

Код WC_Product_CSV_Importer::adjust_character_encoding() WC 11.3.0

private function adjust_character_encoding( $value ) {
	$encoding = $this->params['character_encoding'];

	// Skip conversion when the value is already UTF-8 or when mbstring is unavailable.
	if ( 'UTF-8' === $encoding || ! function_exists( 'mb_convert_encoding' ) ) {
		return $value;
	}

	return mb_convert_encoding( $value, 'UTF-8', $encoding );
}