WC_Product_CSV_Importer::adjust_character_encoding │ private │ WC 1.0

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

Method of the class: WC_Product_CSV_Importer{}

No Hooks.

Returns

string. The converted string.

Usage

// private - for code of main (parent) class only
$result = $this->adjust_character_encoding( $value );
$value(string) (required)
The string to convert.

WC_Product_CSV_Importer::adjust_character_encoding() code WC 11.1.2

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 );
}