Created
October 15, 2021 16:30
-
-
Save abdullahoguk/a047f3abeadf768a5c52a044628dcb05 to your computer and use it in GitHub Desktop.
UTF-8 Display to Text (Turkish) with multiple replace in JavaScript
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
/*bozuk türkçe karakter düzeltme*/ | |
function fixTrChars(str) { | |
var karakterler = [{'ı': 'ı'}, {'ç': 'ç'}, {'ÅŸ': 'ş'}, {'ö': 'ö'}, {'ü': 'ü'}, {'ÄŸ': 'ğ'}, { 'Ä°': 'İ'}, { 'Ç': 'Ç'}, { 'ÅŸ': 'Ş'},{'Ö':'Ö'}, {'Ãœ': 'Ü'}, {'ÄŸ': 'Ğ'}]; | |
return karakterler.reduce(function (accum, t) { | |
return accum.replace(new RegExp(Object.keys(t)[0], 'g'), t[Object.keys(t)[0]]); | |
}, str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment