用PHP生成的乱码导入希伯来语excel文件

时间:2022-08-15 10:07:35

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.

我已经尝试了很多东西来解决这个问题但没有成功。我试图导入一个excel文件(xls / xlsx / csv),其中包含希伯来字符。

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,

我试过的每一种方法,包括fopen / php-excel-reader和其他人都在乱码输出数据,每次尝试将编码更改为UTF-8都以相同的结果结束,

can you offer a solution for this problem ?

你能为这个问题提供解决方案吗?

Thanks

2 个解决方案

#1


4  

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.

尝试将excel_reader2.php的第635行更改为$ val = htmlentities($ val); $ val = htmlentities($ val,ENT_NOQUOTES,'utf-8');我过去也有同样的问题,这就像一个魅力。

#2


2  

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.

Excel使用代码页值来标识工作簿中使用的字符集。很可能,OEM希伯来语的设置为862(CP862)。但是,并非所有的读者库都会费心去检查所使用的代码页(我不知道php-excel-reader),或者转换为“通用”的任何东西,所以你可能需要使用iconv()或mb_ *函数把CP862转换成UTF-8。

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

#1


4  

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.

尝试将excel_reader2.php的第635行更改为$ val = htmlentities($ val); $ val = htmlentities($ val,ENT_NOQUOTES,'utf-8');我过去也有同样的问题,这就像一个魅力。

#2


2  

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.

Excel使用代码页值来标识工作簿中使用的字符集。很可能,OEM希伯来语的设置为862(CP862)。但是,并非所有的读者库都会费心去检查所使用的代码页(我不知道php-excel-reader),或者转换为“通用”的任何东西,所以你可能需要使用iconv()或mb_ *函数把CP862转换成UTF-8。

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