将小写字母 "i" 转换为大写字母“İ”时会出现不同的字符(Wordpress Gravity)

a different character appears when converting lowercase "i" to uppercase "İ" (Wordpress Gravity)

我在发布 Wordpress 重力表单插件的“输入”数据时使用 function.php 代码将所有字符转换为大写。

add_action('gform_pre_submission_1', 'capitalize_fields_1');
function capitalize_fields_1($form){
// add all the field IDs you want to capitalize, to this array
$fields_to_cap = array('input_1');
        foreach ($fields_to_cap as $each) {
                // for each field, convert the submitted value to uppercase and assign back to the POST variable
                // the rgpost function strips slashes
                
                $_POST[$each] = strtoupper(rgpost($each));
        }
        // return the form, even though we did not modify it
        return $form;
}

但是,我使用的是土耳其语,并且有一个字符不属于 UTF-8。小写字母“i”在转换时变成字母“I”。这两个字符的含义各不相同。我想把小写字母“i”转换成字母“I”。

我找到了这个过程的 php 代码,但我无法将其适应 function.php 文件。

function mb_strtoupper_tr($metin){
    $metin=str_replace('i', 'İ', $metin);

任何人都可以帮助我如何适应这个或实施更有效的方法吗?

add_action('gform_pre_submission_1', 'capitalize_fields_1');
function capitalize_fields_1($form){
// add all the field IDs you want to capitalize, to this array
$fields_to_cap = array('input_1');
        foreach ($fields_to_cap as $each) {
                // for each field, convert the submitted value to uppercase and assign back to the POST variable
                // the rgpost function strips slashes
                
                $_POST[$each] = strtoupper(str_replace('i', 'İ', rgpost($each)));
        }
        // return the form, even though we did not modify it
        return $form;
}