iconv命令可以将一种已知的字符集文件转换成另一种已知的字符集文件。
iconv -- Convert string
to requested character encoding
string iconv ( string in_charset,
string out_charset, string str )
Performs a character set conversion
on the string str from in_charset to out_charset. Returns the converted string
or FALSE on failure.
If you append the string //TRANSLIT to out_charset
transliteration is activated. This means that when a character can't be
represented in the target charset, it can be approximated through one or several
similarly looking characters. If you append the string //IGNORE, characters that
cannot be represented in the target charset are silently discarded. Otherwise,
str is cut from the first illegal character.
例子 iconv()
example:
<?php
echo iconv("UTF-8", "GB2312", "This is a
test.");//把UTF-8编码的“This is a test.”转换成GB2312编码
?>
分享到:
相关推荐
我在做一个加密芯片项目...1.如要iconv_open、iconv_close这样的名字,需在iconv.h中加入#define LIBICONV_PLUG即可。 2.如要libiconv_open、libiconv_close这样的名字,需在iconv.h中移除#define LIBICONV_PLUG即可。
extern size_t iconv (iconv_t cd, @ICONV_CONST@ char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft); /* Frees resources allocated for conversion descriptor ‘cd’. */ #ifndef ...
iconv是文件编码格式转换工具。 提供的iconv.exe是iconv的Windows版。
iconv是知名的开源跨平台编码转换库,iconv.exe是iconv库在windows下的命令行工具,iconv.exe的一般用法:iconv.exe -f gbk -t utf-8 gbk.txt > utf-8.txt。其中 -f gbk 指明转换前的文件编码是gbk,-t utf-8 指明...
iconv.h iconv.lib charset.lib 编译时缺少文件时可以用
iconv_ret = iconv(cd,pin,&inlen,pout,&outlen); if (iconv_ret == (size_t)-1) { perror("iconv():"); exit(0); } iconv_close(cd); return 0; } int u2g(char *inbuf,int inlen,char *outbuf,int ...
本来以为很简单 结果找了半天发现都是很坑爹的办法 linux下可以直接安装luaiconv windows下呢 只好自己编了 本来想找个别人写好的 发现根本找不到 更坑爹的是 我用eclipse的LDT开发 结果发现它的lua vm没办法加载c库...
windows下可使用的iconv静态库,只需引入iconv.h,iconv.lib即可,使用方法见示例文件。
iconv库32位版和64位版都含有,其中包含编译好的: charset.lib、iconv.lib、iconv.dll、charset.dll、iconv.exe 以及头文件:iconv.h、libcharset.h、localcharset.h 还有说明:iconv.1.html、iconv.3.html 等资源
使用最新的1.15版本代码编译的iconv静态库。使用MinGW 4.9.2编译器,Codeblocks创建工程,带示例,示例为UTF8转SHIFT-JIS编码,静态库经测试可用,目前尚未发现异常。
iconv_open("utf-8", "gb2312") 调用失败
iconv.
在Linux下有个iconv.h头文件,里面是对编码转换处理的封装。但在windows下是没有这个头文件的。这里有三个文件,高手编写,用在windows下:iconv.h,iconv.dll和iconv.lib,导出库,就可以用iconv.h了。用法与Linux下...
apr-iconv-1.2.1.tar.gzapr-iconv-1.2.1.tar.gz
一个利用iconv函数将GBK码转为UTF-8码的函数,本函数在LINUX系统下测试正常。目前支持中文繁简、日文、英文、俄文等的转码。函数其实很简单,另外精选了一些本人觉得有助于理解ICONV函数及Unicode、GBK这些概念的...
例://把 从gb2312编码转换到 UTF-8 编码=iconv("GB2312","UTF-8",)安装到PHP要使用iconv函数,PHP编译时必须跟上: --with-iconv[=DIR]. Note to Windows® Users: In order to enable this ...
iconv编码转码工具
iconv封装后的cpp接口,含iconv的lib、dll、h文件。 iconv封装后的cpp接口,含iconv的lib、dll、h文件。
iconv-lite - 纯javascript转换字符编码