lior r
lior r

Reputation: 2290

import hebrew excel file with PHP generated gibberish

i have tried many things to solve this but none worked. im trying to import an excel file(xls/xlsx/csv) which contanins hebrew characters.

Every method i tried including fopen/php-excel-reader and others are outputing the data in gibberish , every attempt i have made to change the encoding to UTF-8 ended with the same results,

can you offer a solution for this problem ?

Thanks

Upvotes: 2

Views: 2548

Answers (2)

Giannis
Giannis

Reputation: 813

Try changing in line 635 of excel_reader2.php to $val = htmlentities($val); with $val = htmlentities($val,ENT_NOQUOTES, 'utf-8'); I had the same problem in the past, and this worked like a charm.

Upvotes: 4

Mark Baker
Mark Baker

Reputation: 212502

Excel uses a codepage value to identify the character set used in the workbook. In all probability, this is set to 862 (CP862) for OEM Hebrew. However, not all reader libraries will bother to check the codepage used (I don't know about php-excel-reader), or to convert to anything "universal", so you probably need to use iconv() or the mb_* functions to convert from CP862 to UTF-8.

$stringCellValue iconv ( 'CP862' , 'UTF-8' , $stringCellValue );

Upvotes: 2

Related Questions