首页 \ 问答 \ utf8_unicode_ci似乎不是UTF8(utf8_unicode_ci seems not to be UTF8)

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
更新时间:2023-10-09 16:10

最满意答案

您实际上没有设置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 the command not found problem.

If you've set your path, using, as an example: PATH=$PATH:$HOME/git-tf-2.0.2.20130214, then the git command will allow the sub-command tf, 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 the git-tf command directly.

The command that is extracted is git-tf, and git is smart enough to look for the git-tf command if you have set the PATH and try to use the operation git tf.

相关问答

更多
  • 不能,软件包管理不一样,二进制不能直接用。 GNU软件如果有相应的源代码可以自行编译安装。至于很多商业软件,国内是不支持Linux的。
  • 点进苹果官网,点击下方的Mac os新系统El Capitan 2 进入Mac os新系统El Capitan页面介绍。 在Mac os新系统El Capitan介绍页面往下滑, 接近页面底部,但还不到底部的样子, 会看到apple beta版软件计划,
  • 有两张盘,一张是mac系统盘,是以后自己重装系统或者改密码什么的。另一张有驱动,在mac上装boot camp 分区。然后剩下的就是和普通机子一样了,不过第二张盘在win上还是要用的,还要在win上装boot camp和其他驱动
  • 别把 Mac 想得太复杂了, Mac 是最适合电脑盲的。 dmg 格式的,双击打开,把图标往 应用程序的文件夹里一拖就 OK了 其他格式的,打开后,点下一步就 OK了
  • Mac OS X是指Macintosh操作系统10,10在罗马数字里是X,每个版本用不同的大型猫科动物命名包括10.5和10.6,你可以看看百度百科对Mac OS X
  • 这里可以直接点击屏幕顶部菜单栏中的网络图标,如图所示 接着请点击网络列表底部的“打开网络偏好设置”选项,如图所示 打开网络设置窗口以后,接着请点击“高级”按钮,如图所示 随后即可看到电脑网卡的 MAC 地址了,这里以我 Mac 上的无线网卡为例。
  • 在回答之前先向楼上童鞋致以严重的鄙视.. 两者的功能完全一样,只是面向的系统板本不一样.有combo的可以从任何版本的Leopard更新到目标版本,而没有combo的必须从上一版本更新.简单吧~
  • 您实际上没有设置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开发人员,但您的要求是否适合SQLite ? 这是一个关于入门的教程。 I'm not a MAC developer, but will your requirement fit SQLite? Here's a tutorial on Getting Started.
  • 如果使用Wine,则可以在OS X上加载DLL。 不能使用Java加载它们。 You can load DLLs on OS X if you use Wine. Loading them using just Java is not possible.

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)