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之MVC模式
MVC (Model-View-Controller):M是指逻辑模型,V是指视图模型,C则是控制器.一个逻辑模型可以对于多种视图模型,比如一批统计数据 你可以分别用柱状图.饼图来表示.一种视图模型也 ...
- easyui icon的使用相关
easyui的默认图标有以下这些: .icon-blank{ background:url('icons/blank.gif') no-repeat; } .icon-add{ background: ...
- Page的ResolveClientUrl与ResolveUrl读取路径
Page的ResolveClientUrl与ResolveUrl读取路径 . 一.Page对象的ResolveClientUrl与ResolveUrl Page.ResolveClientUrl(): ...
- Android系统广播机制存在漏洞,恶意软件可绕过安全机制跟踪用户
前言 国外研究人员披露了Android漏洞(CVE-2018-9489)的信息.Android系统的内部广播机制会暴露敏感的用户和设备信息,手机上安装的应用可在用户不知情或未经许可的情况下访问获取这些 ...
- fonts.conf 中文手册
FONTS-CONF(5) FONTS-CONF(5) 名称 fonts.conf -- 字体配置文件 文件概要 /etc/fonts/fonts.conf /etc/fonts/fonts.dtd ...
- 【Python】Django用户、认证、鉴权模块使用
此文是总结Django官方网站里面的Document的文章 User authentication in Django http://www.djangoproject.com/documentati ...
- JS中括号的用法
转自:http://blog.csdn.net/hongmin118/article/details/4584023 我们在一些JS代码中经常可以看到这样的用法 :(function(){})();那 ...
- UNIX网络编程读书笔记:地址操纵函数
地址格式转换函数:它们在ASCII字符串(人们比较喜欢用的格式)与网络字节序的二进制值(此值存于套接口地址结构中)间转换地址. 1.inet_aton.inet_addr.inet_ntoa inet ...
- spring测试实例
我们以前要进行单元测试,必须先得到ApplicationContext对象,再通过它得到业务对象,非常麻烦,重复代码也多.基于spring3的单元测试很好的解决了这个问题 基于spring3的单元测试 ...
- poj 1125 (floyed 最短路径)
Stockbroker Grapevine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26395 Accepted: ...