Merhaba,

Şöyle bir kod parçası var:

*****************************************************************************
if ($mbstring_list !== false) {
            $aliases['WINDOWS-1257'] = 'ISO-8859-13';
            // it happens that mbstring supports ASCII but not US-ASCII
            if (($from == 'US-ASCII' || $to == 'US-ASCII') &&
!in_array('US-ASCII', $mbstring_list)) {
                $aliases['US-ASCII'] = 'ASCII';
            }

            $mb_from = $aliases[$from] ? $aliases[$from] : $from;
            $mb_to   = $aliases[$to] ? $aliases[$to] : $to;
*var_dump($from); die();*
            // return if encoding found, string matches encoding and
convert succeeded
            if (in_array($mb_from, $mbstring_list) && in_array($mb_to,
$mbstring_list)) {
                if (mb_check_encoding($str, $mb_from)) {
                    // Do the same as //IGNORE with iconv
                    mb_substitute_character('none');
                    $out = mb_convert_encoding($str, $mb_to, $mb_from);
                    mb_substitute_character($mbstring_sch);

                    if ($out !== false) {
                        return $out;
                    }
                }
            }
        }
*****************************************************************************
Bu hali ekrana şunu döküyor:
*string(5) "UTF-8"*

Kodu şöyle değiştirince
*************************************************
if ($mbstring_list !== false) {
            $aliases['WINDOWS-1257'] = 'ISO-8859-13';
            // it happens that mbstring supports ASCII but not US-ASCII
            if (($from == 'US-ASCII' || $to == 'US-ASCII') &&
!in_array('US-ASCII', $mbstring_list)) {
                $aliases['US-ASCII'] = 'ASCII';
            }

            $mb_from = $aliases[$from] ? $aliases[$from] : $from;
            $mb_to   = $aliases[$to] ? $aliases[$to] : $to;

            // return if encoding found, string matches encoding and
convert succeeded
            if (in_array($mb_from, $mbstring_list) && in_array($mb_to,
$mbstring_list)) {
                if (mb_check_encoding($str, $mb_from)) {
                    // Do the same as //IGNORE with iconv
                    mb_substitute_character('none');
                    $out = mb_convert_encoding($str, $mb_to, $mb_from);
                    mb_substitute_character($mbstring_sch);
*var_dump($from); die();*
                    if ($out !== false) {
                        return $out;
                    }
                }
            }
        }
****************************************************
Ekrana yine şunu döküyor:
*string(5) "UTF-8"*


Ama kodu şu şekilde değiştirince
*****************************************************
if ($mbstring_list !== false) {
            $aliases['WINDOWS-1257'] = 'ISO-8859-13';
            // it happens that mbstring supports ASCII but not US-ASCII
            if (($from == 'US-ASCII' || $to == 'US-ASCII') &&
!in_array('US-ASCII', $mbstring_list)) {
                $aliases['US-ASCII'] = 'ASCII';
            }

            $mb_from = $aliases[$from] ? $aliases[$from] : $from;
            $mb_to   = $aliases[$to] ? $aliases[$to] : $to;

            // return if encoding found, string matches encoding and
convert succeeded
            if (in_array($mb_from, $mbstring_list) && in_array($mb_to,
$mbstring_list)) {
                if (mb_check_encoding($str, $mb_from)) {
                    // Do the same as //IGNORE with iconv
                    mb_substitute_character('none');
                    $out = mb_convert_encoding($str, $mb_to, $mb_from);
                    mb_substitute_character($mbstring_sch);

                    if ($out !== false) {
                        return $out;
                    }
                }
            }
*var_dump($from); die();*
        }
********************************************************
Bu sefer ekrana başka bir sonuç döküyor:
*string(9) "SO-8859-9"*

Sorun bende mi, yoksa PHP'de mi?


--
Görünenler, gerçek olsaydı bilime gerek kalmazdı.
_______________________________________________
Linux-programlama mailing list
[email protected]
https://liste.linux.org.tr/mailman/listinfo/linux-programlama
Liste kurallari: http://liste.linux.org.tr/kurallar.php

Cevap