简体   繁体   English

使用PHP将希伯来字符转换为UTF-8

[英]Converting Hebrew characters to UTF-8 using PHP

i have a MySQL field value with a json object containing Hebrew characters like this: 我有一个MySQL字段值,其中包含一个包含希伯来字符的json对象,如下所示:

[{"name":"אספנות ואומנות","value":1,"target":null},{"name":"אופניים","value":2,"target":null}]

(the one in the name field) (名称字段中的那个)

This field output is giving me some trouble with a certain web interface. 该字段输出给我某些Web界面带来的麻烦。 so, looking around in the database i found another field containing json object and its output works fine. 因此,在数据库中环顾四周,我发现了另一个包含json对象的字段,其输出正常。

[{"name":"\u05d0\u05e1\u05e4\u05e0\u05d5\u05ea \u05d5\u05d0\u05d5\u05de\u05e0\u05d5\u05ea","value":1,"target":null},{"name":"\u05d0\u05d5\u05e4\u05e0\u05d9\u05d9\u05dd","value":2,"target":null}]

So i would like to convert the first field to this encoding to see if its solves the output issue. 所以我想将第一个字段转换为这种编码,以查看其是否解决了输出问题。

what is this encoding ? 这是什么编码? is it UTF-8 ? 是UTF-8吗? how can i convert it using PHP ? 如何使用PHP进行转换?

i tried to isolate the value and convert it to UTF-8 using 我试图隔离值并将其转换为UTF-8使用

echo iconv("Windows-1255","UTF-8",'אספנות ואומנות');

but its just returning an empty value. 但它只是返回一个空值。

Any help would be great 任何帮助都会很棒

So, in PHP 因此,在PHP中

json_encode('אספנות ואומנות');

did the trick 做到了

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM