$str = "Hello world!"; $convertedStr = CUtil::ConvertToLangCharset($str, "UTF-8"); echo $convertedStr; // Output: Hello world!
$str = "Привет мир!"; $convertedStr = CUtil::ConvertToLangCharset($str, "windows-1251"); echo $convertedStr; // Output: Ïðèâåò ìèð!In the above examples, `$str` is the string to be converted, and the second parameter of `CUtil::ConvertToLangCharset()` is the target character set. Overall, `CUtil ConvertToLangCharset` is a useful function for handling encoding issues when working with strings in PHP, and it can be an essential tool for developers using the Bitrix CMS package library.