search
HomeBackend DevelopmentPHP Tutorial 为什么iconv把不识别的字符转换成0,该如何解决

为什么iconv把不识别的字符转换成0

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php $str = "100┫面积";
$content=iconv("gb2312","utf-8//ignore",$str);
echo $content;
?>


会输出 “1000面积”,ignore的意思不是忽略吗,怎么转换成0了?
如果用mb_convert_encoding()则会输出 “100?面积”
有没有好的方法处理

------解决方案--------------------
gb2312换成gbk
------解决方案--------------------
因为 gb2312 是gbk的子集。很多特殊字符gb2312不支持。而gbk支持。
------解决方案--------------------
GBK是gb2312的扩展版本,有很多在gb2312没有对应编码的字符,GBK都有。
就好像GBK是php5,gb2312是php4,向下兼容并有扩充。
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Go语言编码解析:UTF-8与GBK对比Go语言编码解析:UTF-8与GBK对比Mar 28, 2024 pm 01:54 PM

Go语言编码解析:UTF-8与GBK对比在Go语言中,处理字符串编码是常见的任务之一。其中,UTF-8和GBK是两种常用的字符编码方式。本文将对UTF-8和GBK进行详细对比,探讨它们的区别和使用方法,并附上具体的代码示例。一、UTF-8与GBK的简介UTF-8:UTF-8是一种可变长度的Unicode编码方式,它可以表示世界上几乎所有语言的字符。UTF-8

php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决php提交表单通过后,弹出的对话框怎样在当前页弹出,该如何解决Jun 13, 2016 am 10:23 AM

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code<form name="myform"

CSS 内容属性详解:content、counter 和 quotesCSS 内容属性详解:content、counter 和 quotesOct 21, 2023 am 10:16 AM

CSS内容属性详解:content、counter和quotesCSS(层叠样式表)是前端开发中不可或缺的一部分,它可以帮助我们美化网页并增强用户体验。在CSS中,有一些特殊的属性可以用于控制文本内容的显示,其中包括content、counter和quotes。本文将详细介绍这些属性,并提供具体的代码示例。一、content属性content属性

WIN10将字符集从gbk改为utf_8的方法教程WIN10将字符集从gbk改为utf_8的方法教程Mar 27, 2024 pm 05:20 PM

1、在开始菜单点击鼠标右键,点一下运作。2、键入control回车键开启操作面板>钟表和地区>地区>管理方法>更该操作系统地区设定>发票勾选"Beta版:应用UnicodeUTF-8保证全世界語言适用"。

PHP改变字体中的字符编码矢量PHP改变字体中的字符编码矢量Mar 21, 2024 pm 03:11 PM

这篇文章将为大家详细讲解有关PHP改变字体中的字符编码矢量,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。PHP中改变字符串中的字符编码在php中,字符串的字符编码决定了其中字符的表示方式。要更改字符串的字符编码,可以使用以下步骤:1.确定当前字符编码$encoding=mb_detect_encoding($string);这将返回一个字符串,表示字符串的当前字符编码,例如"UTF-8"或"ISO-8859-1"。2.使用mb_convert_encoding

Microsoft AI CEO says using open web content to train AI models isn\'t wrongMicrosoft AI CEO says using open web content to train AI models isn\'t wrongJun 30, 2024 pm 10:59 PM

In an interview with CNBC's Andrew Ross Sorkin, Microsoft AI CEO Mustafa Suleymanexpressed his understanding of web copyright law. Suleyman says that content that is accessible on the open web is "freeware," and anyone can copy it, reproduc

图片消失怎么解决图片消失怎么解决Apr 07, 2024 pm 03:02 PM

图片消失如何解决先是图片文件上传$file=$_FILES['userfile'];  if(is_uploaded_file($file['tmp_name'])){$query=mysql_query("INSERT INTO gdb_banner(image_src ) VALUES ('images/{$file['name'

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没有关问题Jun 13, 2016 am 10:15 AM

不用数据库来实现用户的简单的下载,代码如下,但是却不能下载,请高手找下原因,文件路劲什么的没问题。<?phpfunction down_file($file_name,$file_sub_dir){//为防止乱码使用函数iconv$file_name=iconv("utf-8","gb2312",$file_

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.