| 101 | | $source_encoding = mb_detect_encoding($text); |
|---|
| 102 | | $target_encoding = _get_codeset(); |
|---|
| 103 | | if ($source_encoding != $target_encoding) { |
|---|
| 104 | | return mb_convert_encoding($text, $target_encoding, $source_encoding); |
|---|
| 105 | | } |
|---|
| 106 | | else { |
|---|
| 107 | | return $text; |
|---|
| 108 | | } |
|---|
| | 101 | // TODO: check support for mbstring functions |
|---|
| | 102 | if (extension_loaded('mbstring')) { |
|---|
| | 103 | $source_encoding = mb_detect_encoding($text); |
|---|
| | 104 | $target_encoding = _get_codeset(); |
|---|
| | 105 | if ($source_encoding != $target_encoding) { |
|---|
| | 106 | return mb_convert_encoding($text, $target_encoding, $source_encoding); |
|---|
| | 107 | } |
|---|
| | 108 | else { |
|---|
| | 109 | return $text; |
|---|
| | 110 | } |
|---|
| | 111 | } else { |
|---|
| | 112 | return $text; |
|---|
| | 113 | } |
|---|