Last active
June 21, 2023 12:52
-
-
Save halillusion/a468a46929ba94681431ef7544a5c0fa to your computer and use it in GitHub Desktop.
Turkish Character Fixer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function turkishCharacterFixer($string) | |
{ | |
// = <0x9d> | |
// Some Special Characters | |
$find = ['•', '“', 'â€', '‘', '’']; | |
$repl = ['•', '“', '”', '‘', '’']; | |
$string = str_replace($find, $repl, $string); | |
// İ and ı Characters | |
$find = ['ݾ', 'Ý', 'Ä°', 'Ã', '‹', 'Ý', 'Ä°', 'İ' ]; | |
$repl = 'İ'; | |
$string = str_replace($find, $repl, $string); | |
$find = ['ý', 'ı', '±', 'ý', 'Û', '›', 'ý', 'ı', 'ı', 'ı']; | |
$repl = 'ı'; | |
$string = str_replace($find, $repl, $string); | |
// Ş and ş Characters | |
$find = [ 'Þ', 'Åž', 'ÅŸ', 'åÿ', 'Þ', 'Åž', 'Ş' ]; | |
$repl = 'Ş'; | |
$string = str_replace( $find, $repl, $string ); | |
$find = [ 'þ', 'Å?', 'ÅŸ', 'þ', 'ÅŸ', 'ş' ]; | |
$repl = 'ş'; | |
$string = str_replace($find, $repl, $string); | |
// Ğ and ğ Characters | |
$find = [ 'Ð', 'Äž', 'Äž', 'Ğ' ]; | |
$repl = 'Ğ'; | |
$string = str_replace( $find, $repl, $string ); | |
$find = [ 'ð', 'Ä?', 'ÄŸ', 'ð', 'ÄŸ', 'ğ' ]; | |
$repl = 'ğ'; | |
$string = str_replace($find, $repl, $string); | |
// Ç and ç Characters | |
$find = [ 'Ç', 'Ã?' ,'Ç', 'Ç' ]; | |
$repl = 'Ç'; | |
$string = str_replace( $find, $repl, $string ); | |
$find = [ 'ç', 'ç', 'ç']; | |
$repl = 'ç'; | |
$string = str_replace($find, $repl, $string); | |
// Ö and ö Characters | |
$find = [ 'Ö', 'Ö', 'Ö' ]; | |
$repl = 'Ö'; | |
$string = str_replace( $find, $repl, $string ); | |
$find = [ 'ö', 'ö', 'ö']; | |
$repl = 'ö'; | |
$string = str_replace($find, $repl, $string); | |
// Ü and ü Characters | |
$find = [ 'Ãœ', 'Ü', 'Ãœ']; | |
$repl = 'Ü'; | |
$string = str_replace( $find, $repl, $string ); | |
$find = [ 'ü', 'ã¼', 'ü', 'ü', 'ü']; | |
$repl = 'ü'; | |
$string = str_replace($find, $repl, $string); | |
return $string; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment