utf8_unicode_ci似乎不是UTF8(utf8_unicode_ci seems not to be UTF8)
我的mySql数据库有些奇怪...我的表格编码为“utf8_unicode_ci”,但是当我对它进行SELECT时,数据似乎不是UTF8,因为json_encode给出一个空字符串。
我必须重新浏览结果以重新编码UTF8中的数据...
$q = $this->db->prepare("SELECT ..."); $q->execute(); $data = $q->fetchAll(); foreach ($data as $key => $value) { $data[$key] = utf8_encode($value); } return $data;
在那之后,json_encode完成了他的工作。 但是我不明白为什么我的表格中的SELECT结果在“utf8_unicode_ci”中编码不会直接提取UTF8中的数据...重新浏览数组是非常多余的...
感谢帮助
I got something strange with my mySql database... My tables are encode in "utf8_unicode_ci", but when I make a SELECT on it, data seems not to be UTF8 because json_encode give an empty string.
I have to re browse the result to re-encode the data in UTF8...
$q = $this->db->prepare("SELECT ..."); $q->execute(); $data = $q->fetchAll(); foreach ($data as $key => $value) { $data[$key] = utf8_encode($value); } return $data;
After that, json_encode do his job. But I don't understand why the SELECT result from my table encode in "utf8_unicode_ci" doesn't extract the data in UTF8 directly... It is very redundant to re-browse the array...
Thanks for help
原文:https://stackoverflow.com/questions/43472912
最满意答案
您实际上没有设置
PATH
变量,这就是为什么您command not found
问题。如果您已设置路径,请使用,例如:
PATH=$PATH:$HOME/git-tf-2.0.2.20130214
,然后git
命令将允许子命令tf
,这应该像文档建议的那样工作,如:git tf clone …
一旦设置了
PATH
变量就会工作,否则你将不得不直接引用git-tf
命令。提取的命令是
git-tf
,如果已设置PATH
并尝试使用操作git tf
,则git-tf
足够智能以查找git-tf
命令。You haven't actually set your
PATH
variable, which is why you're getting thecommand not found
problem.If you've set your path, using, as an example:
PATH=$PATH:$HOME/git-tf-2.0.2.20130214
, then thegit
command will allow the sub-commandtf
, which should work like the documentation suggests, as in:git tf clone …
will work once you've set the
PATH
variable, otherwise you'll have to reference thegit-tf
command directly.The command that is extracted is
git-tf
, and git is smart enough to look for thegit-tf
command if you have set thePATH
and try to use the operationgit tf
.
相关问答
更多-
linux下能安装使用mac os的软件吗?[2023-09-29]
不能,软件包管理不一样,二进制不能直接用。 GNU软件如果有相应的源代码可以自行编译安装。至于很多商业软件,国内是不支持Linux的。 -
如何升级mac os 10.12[2022-09-26]
点进苹果官网,点击下方的Mac os新系统El Capitan 2 进入Mac os新系统El Capitan页面介绍。 在Mac os新系统El Capitan介绍页面往下滑, 接近页面底部,但还不到底部的样子, 会看到apple beta版软件计划, -
mac OS如何装双系统?[2022-09-12]
有两张盘,一张是mac系统盘,是以后自己重装系统或者改密码什么的。另一张有驱动,在mac上装boot camp 分区。然后剩下的就是和普通机子一样了,不过第二张盘在win上还是要用的,还要在win上装boot camp和其他驱动 -
mac os x 如何安装应用软件[2022-10-28]
别把 Mac 想得太复杂了, Mac 是最适合电脑盲的。 dmg 格式的,双击打开,把图标往 应用程序的文件夹里一拖就 OK了 其他格式的,打开后,点下一步就 OK了 -
Mac OS X 和Mac OS 10.5 , Mac OS 10.6三者区别在哪里 有什么不同[2022-02-22]
Mac OS X是指Macintosh操作系统10,10在罗马数字里是X,每个版本用不同的大型猫科动物命名包括10.5和10.6,你可以看看百度百科对Mac OS X -
6s中mac os在哪打开[2024-01-25]
这里可以直接点击屏幕顶部菜单栏中的网络图标,如图所示 接着请点击网络列表底部的“打开网络偏好设置”选项,如图所示 打开网络设置窗口以后,接着请点击“高级”按钮,如图所示 随后即可看到电脑网卡的 MAC 地址了,这里以我 Mac 上的无线网卡为例。 -
Mac OS X Upd和Mac OS X UpdCombo的区别[2022-12-04]
在回答之前先向楼上童鞋致以严重的鄙视.. 两者的功能完全一样,只是面向的系统板本不一样.有combo的可以从任何版本的Leopard更新到目标版本,而没有combo的必须从上一版本更新.简单吧~ -
TFS与mac os(TFS with mac os)[2023-04-29]
您实际上没有设置PATH变量,这就是为什么您command not found问题。 如果您已设置路径,请使用,例如: PATH=$PATH:$HOME/git-tf-2.0.2.20130214 ,然后git命令将允许子命令tf ,这应该像文档建议的那样工作,如: git tf clone … 一旦设置了PATH变量就会工作,否则你将不得不直接引用git-tf命令。 提取的命令是git-tf ,如果已设置PATH并尝试使用操作git tf ,则git-tf足够智能以查找git-tf命令。 You hav ... -
Mac OS上的DataBase(DataBase on Mac OS)[2024-03-23]
我不是MAC开发人员,但您的要求是否适合SQLite ? 这是一个关于入门的教程。 I'm not a MAC developer, but will your requirement fit SQLite? Here's a tutorial on Getting Started. -
dll可以加载到MAC OS上(dll can be loaded on MAC os)[2023-03-01]
如果使用Wine,则可以在OS X上加载DLL。 不能使用Java加载它们。 You can load DLLs on OS X if you use Wine. Loading them using just Java is not possible.