MongoDB PHP UTF-8 problems

前端 未结 3 1603
暖寄归人
暖寄归人 2020-12-03 03:44

Assume that I need to insert the following document:

{
    title: \'Péter\'
}

(note the é)

It gives me an error when I use the foll

3条回答
  •  误落风尘
    2020-12-03 04:01

    Can I change the character-encoding of MongoDB...

    No data is stored in BSON. According to the BSON spec, all string are UTF-8.

    Now, when I request the document, I still have to decode it ... : Is there some way to automate this process?

    It sounds like you are trying to output the data to web page. Needing to "decode" text that was already encoded seems incorrect.

    Could this output problem be a configuration issue with Apache+PHP? UTF8+PHP is not automatic, a quick online search brought up several tutorials on this topic.

提交回复
热议问题