Php pspell返回问号(;)
我尝试使用以下命令在Ubuntu trusty发行版上安装pspell:Php pspell返回问号(;),php,ubuntu,aspell,pspell,Php,Ubuntu,Aspell,Pspell,我尝试使用以下命令在Ubuntu trusty发行版上安装pspell: sudo apt get安装libpspell dev sudo apt get安装php5 pspell 苏多准备安装一个新的系统 由于在安装过程中没有返回错误,因此该过程似乎已成功 然而,当我在行动中尝试这一点时,我得到了一系列的问号(�): 我使用view的原因是,因为我认为网页可能需要一些字符集,所以我使用HTML5文档结构来实现这一点,但结果保持不变 我的HTML标记: <!doctype html&g
sudo apt get安装libpspell dev
sudo apt get安装php5 pspell
苏多准备安装一个新的系统
由于在安装过程中没有返回错误,因此该过程似乎已成功
然而,当我在行动中尝试这一点时,我得到了一系列的问号(�):
我使用view的原因是,因为我认为网页可能需要一些字符集,所以我使用HTML5文档结构来实现这一点,但结果保持不变
我的HTML标记:
<!doctype html>
<html lang="he">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
סתם טקסט לבדיקה
<?php print_r($suggestions); ?>
</body>
</html>
出于某种原因,对于任何给定的单词,它都返回“nope”,这意味着pspell\u check
返回false
你知道怎么解决这个问题吗
编辑:
尝试检索结果的长度时:
<!doctype html>
<html lang="he">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
@foreach($suggestions as $suggestion)
{{ strlen($suggestion) }} <br>
@endforeach
</body>
</html>
这意味着从
pspell\u suggest
方法返回的结果可能在从aspell字典检索数据时遇到问题?这看起来像是编码问题。您应该使用UTF-8
来处理HTML内容(检查您的页面
并检查是否设置了加密,但是您还必须使用相同的UTF-8
编码的内容填充页面。如果(经常发生)您的PHP文件不是UTF8,则会出现编码不匹配和�改为code>。由于每个单词检查返回的结果都相同,因此我怀疑传递给pspell\u suggest
函数的值可能已损坏
我所做的只是告诉pspell使用UTF-8:
$t = pspell_new('he', "", "", "utf-8");
这解决了问题。嘿,我试过了。看看我编辑的答案,看看我正在使用的HTML。回答是:� [1] => � [2] => � [3] => � [4] => � [5] => � [6] => � )代码>。不幸的是,问题仍然存在
<!doctype html>
<html lang="he">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
@foreach($suggestions as $suggestion)
{{ strlen($suggestion) }} <br>
@endforeach
</body>
</html>
1
1
1
1
1
1
1
$t = pspell_new('he', "", "", "utf-8");