搜索了一下google, 发现也有人发现这个问题, 这其实是ICONV的一个bug
解决方法:
在需要转成的编码后加 “//IGNORE” 也就是iconv函数第二个参数后.
如下:
| iconv(”UTF-8″,”GB2312//IGNORE”,$data) |
ignore的意思是忽略转换时的错误,如果没有ignore参数,所有该字符后面的字符串都无法被保存。
可以查看一下php手册:
iconv
(PHP 4 >= 4.0.5, PHP 5)
iconv — Convert string to requested character encoding
说明
Performs a character set conversion on the string str from in_charset to out_charset .
参数
- in_charset
The input charset.
- out_charset
The output charset.
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.
- str
The string to be converted.
返回值
Returns the converted string or FALSE on failure.
Aptana Studio 2.0 Plugin Installation Instructions
Eclipse Update Site: Installing via Aptana or Eclipse
Update Site:
Detailed Directions:
- From the Help menu, select Install New Software... to open an Install pop-up window.
- In the Work with: text box of the Install window, type the URL http://download.aptana.org/tools/studio/plugin/install/studio for the update site, and hit the Enter key.
- In the populated table below, check the box next to the name of the plug-in, and click the Next button.
- Click the Next button to go to the license page.
- Choose the option to accept the terms of the license agreement, and click the Finish button.
Manual Installation: Download the Plugin Update Site
- Download Studio 2.0 Plugin zip.
- Open Eclipse distribution, and go to Help -> Install New Software....
- Click the Add... button to open the Add Site window.
- Click the Archive... button, and select the file saved in step 1.
- Select the appropriate plugins to install, and click Next -> Next.
- Click the Finish button.
* 排序函数
* @param string $ordername 排序的变量
* @param string $order 排序的name order=1
* @param string $sortname 顺序还是倒序 desc asc
* @param string $sort url里排序的变量如 sort=desc
* @param string $url 要搜索的url
*/
function set_order_url($ordername="",$order = "order", $sortname="desc", $sort="sort" , $url=""){
if(!empty($url)){
//手动设置
$url=$url.((strstr($url,'?'))?'&':'?').$order."=";
}else{
//自动获取
if(empty($_SERVER['QUERY_STRING'])){
//不存在QUERY_STRING时
$url=$_SERVER['REQUEST_URI']."?".$order."=";
}else{
//存在QUERY_STRING时
if($tempstr = strstr($_SERVER['QUERY_STRING'],$order.'=')){
//地址存在排序参数
$need = substr($tempstr,strlen($order.'='), strpos($tempstr, "&")-strlen($order.'='));
$url=str_replace($order.'='.$need,'',$_SERVER['REQUEST_URI']);
$last=$url[strlen($url)-1];
if($last=='?'||$last=='&'){
$url.=$order."=";
}else{
$url.='&'.$order."=";
}
}else{
//地址不存在排序参数
$url=$_SERVER['REQUEST_URI'].'&'.$order.'=';
}
}
}
$url .= $ordername;
//升序降序处理
$sortstr = "/".$sort.'=(desc|asc)/i';
if(preg_match($sortstr, $url, $m)){
//如果已经存在sort=则替换处理
$str = strtolower($m[1]) == "desc" ? "asc" : "desc";
$url = str_replace($m[1], $str, $url);
}
else{
$url .= "&$sort=$sortname";
}
return $url;
}





