Search fails after 4 characters - DataTables JavaScript library

Search fails after 4 characters - DataTables JavaScript library

netingenuitynetingenuity Posts: 3Questions: 0Answers: 0
edited September 2010 in Bug reports
I posted this bug on http://wordpress.org/support/topic/plugin-wp-table-reloaded-search-fails-after-4-characters?replies=2#post-1715265



Can anyone explain why Search fails after 4 characters

On http://66.147.240.198/~iytaorg/teachers-directory/find-an-integral-yoga-teacher

It searches well--up to the fifth character.

Try putting in Washington or Pittsburgh. You'll see teachers listed until you get to the fifth character. Put in the whole word, and none show up.

-----------
And the developer of WP-Tables, Tobias wrote:

Hi,
this seems to be an issue with the DataTables JavaScript library (which offers the search function), as I have heard similar issues before.
Unfortunately, there's nothing I can do, as I don't know the details of the library. Sorry :-(
Instead, I'd ask you to post your question/bug report in the DataTables forums at www.datatables.net/forums.
Best wishes,
Tobias

Replies

  • mstrandmstrand Posts: 24Questions: 0Answers: 0
    edited September 2010
    It looks like some of the data may contain extraneous non-displaying characters. I tried copying and pasting "Washington" from the table and into Windows Notepad and in Notepad it was shown as "Wash­-ing­-ton". Similarly, "Pitts-­burgh" and "Arling­-ton" contained this character and the datatables search fails when that character is reached which makes some sense since the search string doesn't really exists despite appearances to the contrary. You can see that the "Arling-ton" search fails after 5 characters rather than 4.

    Also, "Fair-fax" by itself is split, but where it exists with other cities as in "Reston, Hern­-don, Fairfax" it is not split and so the search for Fairfax succeeds for these rows. And if, for example, "Washington" is copied out of a table cell and pasted into the Search box, the search works since the non-displaying character is then included in the search.

    These hyphens also show up when the data is pasted into Microsoft Word and "Show/hide paragraph marks and other hidden formatting symbols" is toggled on.

    I hope this helps track down the root cause of this problem.
  • netingenuitynetingenuity Posts: 3Questions: 0Answers: 0
    edited October 2010
    Thank you for your insights. I just looked at the .csv file that we used to import that table. All the city names in it are clean and do not have hyhens. Any idea what might have introduced them? I will also try to look at the FileMakerPro source that created that .csv
  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin
    I agree with mstrand - I don't believe that there is anything wrong with DataTables' filtering, but rather the data is not quite as it appears :-). For example, try searching for "catherine" in your table, and it works no problem at all. However, as you note, searching for 'washington' doesn't work - this is because of extraneous characters - the characters which are surplus are (in hex): CA AD. So the string "Washington" looks like:

    57 61 73 68 C2 AD 69 6E 67 C2 AD 74 6F 6E

    It would appear that the display of this character (which by UTF8 is http://www.unicodetools.com/unicode/codepage-utf8.php?page=52 ) depends on the terminal, and font being used. For example on the Firefox console I can't see it - which is why it didn't make sense initially. In my text editor they show up as hyphens.

    So I'd suggest having a look at your csv file in a hex editor and seeing if these characters are in there.

    Allan
  • netingenuitynetingenuity Posts: 3Questions: 0Answers: 0
    I am still stumped by this and hope someone can please help. I opened the file.csv in Text Wrangler on my MacBook Pro and used View/TextView/Show Invisibles and it did not show the hyphens that mstrand and allan both report being able to see. I then copied it to a flash drive and opened it on a Win XP machine in notepad and excel. It would not open in MS Word. I looked online for a HexEditor for Mac and have opened it but don't understand how to use the hex editor. What hex editor do you recommend (for a Mac)? There are just 700 listings of name/address/phone/etc. It is a finite file and I should be able to clean it up, but How can I clean up the file if I can't see the hyphens.

    TIA!
This discussion has been closed.