Search Icon showing 1/4 instead of icon

Search Icon showing 1/4 instead of icon

devman28devman28 Posts: 4Questions: 1Answers: 0
edited December 10 in Free community support

I just downloaded the latest DataTable js and css, but when I generated the table, the column sort is showing garbage with 1/4. Also, the next and previous buttons are showing garbage characters. What am I missing?

Answers

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin

    Almost certainly a UTF-8 encoding server error. If you can link to the page in question I can say for certain what is happening, but my guess is that the DataTables JS and CSS files are being served as latin-1 or something like that, rather than UTF-8.

    Allan

  • devman28devman28 Posts: 4Questions: 1Answers: 0

    Allan, it works correctly if I linked it via CDN, but does not with the download from datatables.net website. So what do I need to do with the downloaded js and css files? Thanks

    <link href="https://cdn.datatables.net/v/dt/dt-2.1.8/datatables.min.css" rel="stylesheet">

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin

    Try:

    <link href="https://cdn.datatables.net/v/dt/dt-2.1.8/datatables.min.css" rel="stylesheet" charset="utf8">
    

    Ideally what would be done by the MIME type sent in the HTTP headers though. It would be worth checking the headers to see what they are.

    Allan

  • devman28devman28 Posts: 4Questions: 1Answers: 0

    Allen, adding the charset="utf8" works for css, but it's the downloaded datatables.min.js file that is causing this latin-1 encoding.

    I want to use the downloaded file rather than using the href endpoint.

    So using the downloaded file locally is still experiencing the issue but it works when I use the following reference link.

    https://cdn.datatables.net/v/dt/dt-2.1.8/datatables.min.js

    So what can I do to the downloaded datatables.min.js file to get it to work locally? Thanks

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin

    Get your server to send it as UTF8 probably. The DataTables' CDN uses:

    content-type: text/javascript; charset=utf-8
    

    as part of the HTTP headers. Have you checked the headers your server is sending?

    Allan

  • devman28devman28 Posts: 4Questions: 1Answers: 0

    Allen, my jsp page already has content-type as "ISO-8859-1"

    all my other include js works properly exception for the downloaded datatabes.min.js

    Sill doesn't work changing it to charset=utf-8 :neutral:

  • allanallan Posts: 63,676Questions: 1Answers: 10,497 Site admin

    If the server is sending it as Latin-1, that might (?) be overriding the UTF-8 charset attribute. Are you able to get your HTTP server to send the JS as UTF-8?

    Perhaps what I need to do is look at changing the defaults in DataTables to use only ASCII, with the UTF-8 characters in an escape sequence. Is it only the paging icons that are causing an issue now?

    Allan

Sign In or Register to comment.