RedBeanHP没有正确保存字符串,从重音元音开始跳过


RedBeanPHP not saving strings correctly, skips from an accented vowel onwards

我正在尝试使用RedBeanPHP保存一些简单的PHP对象。它工作得很好,只是在字符串字段中,它达到了有重音元音的点,即á或"í",并跳过字符串中其余的字符。

示例:

// Actual string in PHP script.
Esta es una frase mía y me gusta!
// Saved to database.
Esta es una frase m

这是我的PHP脚本:

// Setup RedBean to work with a database.
R::setup('mysql:host=localhost;dbname=noticias','root','');
foreach($parsedNews as &$tmpNews) {
    $noticia = R::dispense('noticia');
    $noticia->imagen = $tmpNews->get_image();
    $noticia->fecha = $tmpNews->get_fechanoticia();
    $noticia->titulo = $tmpNews->get_title();
    $noticia->url = $tmpNews->get_sourceurl();
    $noticia->descripcion = $tmpNews->get_description(); 
    $id = R::store($noticia);  
}

我认为正确的答案是源代码实际上不是UTF8。

 $bean->property = iconv("ISO-8859-1", "UTF-8", "Esta es una frase mía y me gusta!");    

将数据库表排序规则设置为UTF-8。(utf8 unicode ci可能就是您想要的)。