Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    I see what you mean, but unfortunately, there’s nothing that I can do here 🙁 This is how JavaScript treats the different characters 🙁

    Regards,
    Tobias

    Thread Starter Metal

    (@metal)

    Solution method: _fnEscapeRegex function replace:

    “function _fnEscapeRegex ( sVal ) {
    var letters = { “İ”: “[İi]”, “I”: “[Iı]”, “Ş”: “[Şş]”, “Ğ”: “[Ğğ]”, “Ü”: “[Üü]”, “Ö”: “[Öö]”, “Ç”: “[Çç]”, “i”: “[İi]”, “ı”: “[Iı]”, “ş”: “[Şş]”, “ğ”: “[Ğğ]”, “ü”: “[Üü]”, “ö”: “[Öö]”, “ç”: “[Çç]” };
    var acEscape = [ ‘/’, ‘.’, ‘*’, ‘+’, ‘?’, ‘|’, ‘(‘, ‘)’, ‘[‘, ‘]’, ‘{‘, ‘}’, ‘\\’, ‘$’, ‘^’, ‘-‘ ];
    var reReplace = new RegExp( ‘(\\’ + acEscape.join(‘|\\’) + ‘)’, ‘g’ );
    sVal=sVal.replace(reReplace, ‘\\$1’);
    return sVal.replace(/(([İIŞĞÜÇÖiışğüçö]))/g, function (letter) { return letters[letter]; });
    }”

    it did not work. Do you have any idea on this?

    • This reply was modified 8 years, 3 months ago by Metal.
    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    interesting approach. What did you do with this function and where did you find the information for it?

    Regards,
    Tobias

    Thread Starter Metal

    (@metal)

    /plugins/tablepress/js/jquery.datatables.min.js => _fnEscapeRegex replace it did not work 🙂

    Method: http://www.bugraguney.com.tr/blog/jquery-js/jquery-datatables-turkce-karakter-sorun-cozumu/

    Thread Starter Metal

    (@metal)

    This code is working:
    “String.prototype.turkishToUpper = function(){
    var string = this;
    var letters = { “i”: “İ”, “ş”: “Ş”, “ğ”: “Ğ”, “ü”: “Ü”, “ö”: “Ö”, “ç”: “Ç”, “ı”: “I” };
    string = string.replace(/(([iışğüçö]))/g, function(letter){ return letters[letter]; })
    return string.toUpperCase();

    Demo: https://yokatlas.yok.gov.tr/tercih-sihirbazi-t3-tablo.php?p=ygs1

    “İstanbul” and “istanbul” found.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for sharing this! This certainly looks interesting, but unfortunately, I don’t really now how to integrate this into the search. As I’m not the developer of the DataTables JS library, I just don’t know the internal details well enough.
    Sorry 🙁

    Regards,
    Tobias

    Thread Starter Metal

    (@metal)

    I understand. I appreciate you for the tablepress I used. I will make a donation when I make money from my site. Thanks TobiasBg.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome!

    Best wishes,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Search Character Problem’ is closed to new replies.