将德语单词存储到 MySql DB 中的问题....? [英] Problem with storing german words into the MySql DB....?

查看:20
本文介绍了将德语单词存储到 MySql DB 中的问题....?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的项目中遇到一个小问题 当我尝试将一些德语单词存储MYSQL 数据库中时.当此德语单词包含变音符号,即字符 ä、ö、ß、ü 等时,它们不会按原样存储.....?

I am facing an small issue in my project When I am trying to store some German words into the MYSQL Database. When this German words contains umlauts i.e. characters ä, ö, ß, ü etc., they are not stored as they are.....?

我想将它们按原样存储到数据库中.为此,我尝试将 COLLATION 更改为 UTF8-general-ci,以及其他在列表中使用 PHP myAdmin.但它们都不适合我.

I want to store them as it is into the Database.To do so I tried to change the COLLATION to UTF8-general-ci, and others in the list using PHP myAdmin. But none of them is working for me.

我的方式是否正确,或者我必须做其他事情.

Am I in the right way or I have to do something else.

请提供一些帮助.

提前致谢......

推荐答案

多年前我遇到过同样的问题.我已经通过为 mysql 隐式设置 NAMES 选项解决了这个问题.在我的代码中它看起来像这样:

years ago I've faced the same problem. I've solved it by implicit setting NAMES option for mysql. In my code it looks like this:

//在 AbstractMapper 类中

//inside AbstractMapper class

public function __construct($modelClass, $dbTable) {
$this->setDbTable($dbTable);
$stmt = new Zend_Db_Statement_Pdo($this->getDbTable()->getAdapter(), 'set names utf8');
$stmt->execute();
$this->_model_class = $modelClass;
}

这篇关于将德语单词存储到 MySql DB 中的问题....?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆