iconv 解决乱码问题
[root@NGINX-APACHE-SVN pro]# file 林.txt
林.txt: ISO-8859 text, with no line terminators
#在LINUX下显示乱码
[root@NGINX-APACHE-SVN pro]# iconv -f GBK -t UTF-8 林.txt -o 林1.txt
[root@NGINX-APACHE-SVN pro]# file 林1.txt
林1.txt: UTF-8 Unicode text, with no line terminators
#问题解决!
[root@NGINX-APACHE-SVN pro]# file 林.txt
林.txt: ISO-8859 text, with no line terminators
[root@NGINX-APACHE-SVN pro]# yum search iconv
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirrors.btte.net
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 1.4 MB 00:03
========================================== N/S Matched: iconv ===========================================
perl-Text-Iconv.x86_64 : Perl interface to iconv() codeset conversion function Name and summary matches only, use "search all" for everything.
[root@NGINX-APACHE-SVN pro]# yum search iconv
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.tuna.tsinghua.edu.cn
* updates: mirror.bit.edu.cn
========================================== N/S Matched: iconv ===========================================
perl-Text-Iconv.x86_64 : Perl interface to iconv() codeset conversion function Name and summary matches only, use "search all" for everything.
名子相同也可以:
root@NGINX-APACHE-SVN pro]# file 20160704mysql.txt
20160704mysql.txt: ISO-8859 text, with CRLF line terminators [root@NGINX-APACHE-SVN pro]# iconv -f GBK -t UTF-8 20160704mysql.txt -o 20160704mysql.txt
[root@NGINX-APACHE-SVN pro]# file 20160704mysql.txt
20160704mysql.txt: UTF-8 Unicode text, with CRLF line terminators
=======================================================================
[root@NGINX-APACHE-SVN pro]# file 交互式创建apache虚拟主机.txt
交互式创建apache虚拟主机.txt: Bourne-Again shell script text executable
#这是个shell肢本,但里面有中文,显示为乱码!
同样用iconv命令来除理,结果成功了!
[root@NGINX-APACHE-SVN pro]# iconv -f GBK -t UTF- 交互式创建apache虚拟主机.txt -o 交互式创建apache虚拟主机.txt
如果去掉#!/bin/bash 再次查看:
[root@NGINX-APACHE-SVN pro]# file 交互式创建apache虚拟主机.txt
交互式创建apache虚拟主机.txt: ISO- text, with CRLF line terminators
所以这个乱码的问题,可以用上面的方法去解决!!
iconv 解决乱码问题的更多相关文章
- SpringMVC解决乱码
SpringMVC解决乱码 在web.xml中配置如下代码
- http get/post解决乱码问题
<form method="默认为get"-> <s:form mothod="默认为post"-> ================= ...
- 上传Text文档并转换为PDF(解决乱码)
前些日子,Insus.NET有分享一篇<上传Text文档并转换为PDF>http://www.cnblogs.com/insus/p/4313092.html 它是按最简单与默认方式来处理 ...
- mysql 使用set names 解决乱码问题的原理
解决乱码的方法,我们经常使用“set names utf8”,那么为什么加上这句代码就可以解决了呢?下面跟着我一起来深入set names utf8的内部执行原理 先说MySQL的字符集问题.Wind ...
- php 解决乱码的通用方法
一,出现乱码的原因分析 1,保存文件时候,文件有自己的文件编码,就是汉字,或者其他国语言,以什么编码来存储 2,输出的时候,要给内容指定编码,如以网页的形势输入时<meta http-equiv ...
- 为sublime安装package control 解决乱码问题 Mac版
为sublime安装package control Mac版参考 https://sublime.wbond.net/installation 防止中文乱码其实只需要2个东东 一个GBK enc ...
- Python字符串的encode与decode研究心得——解决乱码问题
转~Python字符串的encode与decode研究心得——解决乱码问题 为什么Python使用过程中会出现各式各样的乱码问题,明明是中文字符却显示成“/xe4/xb8/xad/xe6/x96/x8 ...
- window安装mysql5.7解压版(解决乱码问题)
♣安装mysql两种方法 ♣下载mysql5.7解压版 ♣配置步骤 ♣解决服务无法启动 ♣解决乱码 1.安装mysql两种方法 MySQL安装文件分为两种,一种是msi格式的,一种是zip格式的.如果 ...
- 编译VisualVM源码解决乱码问题
编译VisualVM源码解决乱码问题 起因 今天在使用VisualVM对测试服务器进行JVM监控的时候,发现所有统计图的横纵坐标都是显示乱码(小方块),即使我的Ubuntu系统使用的是英文语言环境.奇 ...
随机推荐
- Android屏幕尺寸适配注意事项
1 基本设置 1.1 AndroidManifest.xml设置 在中添加子元素 android:anyDensity="true"时,应用程序安装在不同密度的终端上时,程序会分别 ...
- LaTeX图片环境 Picture environment
Picture environment If you need to include simple diagrams or figures in your document, the picture ...
- SASS详解之编译输出的样式
SASS是一种CSS预处理语言,没有装环境的话是不能被解析的.但是有了koala编译工具之后,解析SASS不需要环境也毫无压力了.SASS的输出格式有四种:嵌套.扩大.紧凑和压缩.下面结合小例子为大家 ...
- go语言基础之goto的用法
1.goto的用法 示例: package main //必须有一个main包 import "fmt" func main() { //break //break is not ...
- MonoSingleton——Unity中的单例模式
Unity中有很多特别的类需要以单例模式呈现,比如全局的UI管理类,各种缓存池,以及新手导航类等等.而Unity中,因为所有继承自Monobehaviour的脚本在实现的时候都是单线程的,所以像网上流 ...
- ViewFlipper 淘宝头条 轮播 自动切换
ViewFlipper介绍 ViewFilpper类继承于ViewAnimator,而ViewAnimator类继承于FrameLayout. ViewAnimator: Base class ...
- Cognos权限认证CJP方式之用户密码加密
在项目开发过程中,用户往往对系统的安全都有明确的要求,下面针对cognos门户认证用户密码如何加密来提供一个简单的wf 1Cognos权限认证方式:CJP 2Cognos用户数据库类型:Oracle ...
- [ES6] 01. Intro to ES6 and traceur compiler
---恢复内容开始--- ES6 is ECMAScript version 6, which JavaScript is based on. The next version of JavaScri ...
- Matlab矩阵基本操作(定义,运算)
转自:http://blog.csdn.net/perfumekristy/article/details/8119861 一.矩阵的表示在MATLAB中创建矩阵有以下规则: a.矩阵元素必须在”[ ...
- jtemplate 为javascript前端html模版引擎
最近的项目中用到了jtemplate, 它是客户端基于javascript的模板引擎,绑定的数据为json对象.以前我在页面上显示数据列表时最喜欢用Repeater控件了,因为它相对与其它几个服务端控 ...