关于ssh编码问题
来源:互联网 发布:好听的网络红歌 编辑:程序博客网 时间:2024/06/05 00:22
之前在写SSH时遇到编码问题,本来打算好好学一下的,老板的原因就夭折了,后来那个项目编码一堆乱,最近,公司来了个较牛B的,然后从他那学到了不少,这里就统一用UTF-8。
数据库
建表时
create database xxx character set utf8;
一、查看 MySQL 数据库服务器和数据库字符集的设置。
mysql> show variables like '%char%';
+--------------------------+-------------------------------------+------
| Variable_name | Value |......
+--------------------------+-------------------------------------+------
| character_set_client | utf8 |...... -- 客户端字符集
| character_set_connection | utf8 |......
| character_set_database | utf8 |...... -- 数据库字符集
| character_set_filesystem | binary |......
| character_set_results | utf8 |......
| character_set_server | utf8 |...... -- 服务器字符集
| character_set_system | utf8 |......
| character_sets_dir | D:\MySQL Server 5.0\share\charsets\ |......
+--------------------------+-------------------------------------+------
二、查看 MySQL 数据表(table) 的字符集。
mysql>show full columns from tablename;
mysql>show create table tablename;
mysql>show table status from sqlstudy_db like '%countries%';
+-----------+--------+---------+------------+------+-----------------+------
| Name | Engine | Version | Row_format | Rows | Collation |......
+-----------+--------+---------+------------+------+-----------------+------
| countries | InnoDB | 10 | Compact | 11 | utf8_general_ci |......
+-----------+--------+---------+------------+------+-----------------+------
mysql> show variables like '%char%';
+--------------------------+-------------------------------------+------
| Variable_name | Value |......
+--------------------------+-------------------------------------+------
| character_set_client | utf8 |...... -- 客户端字符集
| character_set_connection | utf8 |......
| character_set_database | utf8 |...... -- 数据库字符集
| character_set_filesystem | binary |......
| character_set_results | utf8 |......
| character_set_server | utf8 |...... -- 服务器字符集
| character_set_system | utf8 |......
| character_sets_dir | D:\MySQL Server 5.0\share\charsets\ |......
+--------------------------+-------------------------------------+------
二、查看 MySQL 数据表(table) 的字符集。
mysql>show full columns from tablename;
mysql>show create table tablename;
mysql>show table status from sqlstudy_db like '%countries%';
+-----------+--------+---------+------------+------+-----------------+------
| Name | Engine | Version | Row_format | Rows | Collation |......
+-----------+--------+---------+------------+------+-----------------+------
| countries | InnoDB | 10 | Compact | 11 | utf8_general_ci |......
+-----------+--------+---------+------------+------+-----------------+------
连接数据库时
jdbc:mysql://localhost:3307/xxx?useUnicode=true&characterEncoding=utf-8
url后面加上
?useUnicode=true&characterEncoding=utf-8
url后面加上
?useUnicode=true&characterEncoding=utf-8
struts2里的配置也要改成utf-8的
页面也改成utf-8的
pageEncoding="utf-8"
页面属性里的也改成utf-8
应该就没问题了
0 0
- 关于ssh编码问题
- ssh编码问题
- SSH框架中的编码问题
- 关于字符编码问题
- 关于字符编码问题
- 关于网络通讯编码问题
- 关于字符编码问题
- 关于网络通讯编码问题
- 关于页面编码问题
- 关于程序编码问题
- 关于编码问题
- 关于javaee编码问题
- 关于编码的问题
- 关于pycharm编码问题
- 关于mysql编码问题
- 关于Java编码问题
- 关于linux编码问题
- 关于转换编码问题
- java环境变量配置
- Android 程序清单详解
- 【C++】PAT(advanced level)1025. PAT Ranking (25)*
- 多核通信
- 使用C#代码部署SharePoint 2013开发包简单总结(一)
- 关于ssh编码问题
- linux 3.11.10, mini2440, usb wifi TL-WN721 8176 ,8192cu ,os_intfs.o error1
- android hanlder loop message的理解
- hive修改表模式
- ADB server didn't ACK, failed to start daemon
- The Elements of Statistical Learning第一章翻译
- iOS动画-CoreAnimation
- 求旱冰场造价[自己改编]
- Unity-裁剪区域自适应