Vish
Vish

Reputation: 4492

£ pound sign not displayed correctly in html document

enter image description here

I am using http://www.datatables.net/ datatables and the data displayed in the table is retrieved dynamically.

Can anyone please help?

The pound sign displays fine when entered in the html document itself. And it also displays fine when viewed in the ajax data url.

UPDATE

I have just realised the content of the csv file was not actually in the utf-8 form. How can I ensure that the uploads are in utf-8 form.

Regards

Upvotes: 0

Views: 2702

Answers (3)

Esailija
Esailija

Reputation: 140244

If you want to reject non UTF-8 files you can do this:

if( !mb_check_encoding( $str, "UTF-8") ) {
    header("HTTP/1.1 400 Bad Request");
    die("File must be in UTF-8 encoding");
}

$str is the file contents read into a PHP string

Upvotes: 0

Vish
Vish

Reputation: 4492

I have now filtered the csv file for the pound sign before it was uploaded and the appended it later on. I am using this hack.

Upvotes: 0

Andy Holmes
Andy Holmes

Reputation: 8087

Have you tried using £ instead of a usual £? Also may need to set your charset to UTF-8

Upvotes: 2

Related Questions