On Thu, Aug 9, 2012 at 9:44 PM, morningtime <
mkoen...@gmail.com> wrote:
> Hi, I'm importing a UTF8 feed into MongoDb. It contains special characters
> such as á, í, ó, but also html encoded etities such as "©" or "®"
> etc.
>
> MongoDb 2.0.6 does this to me on a save() run throuhg PHP 5.4 with the
> official MongoDb driver:
>
> Source: "Bose®"
> Saved in MongoDb as: "Bose&reg;" (broken html!)
>
> Source: "Bose®"
> Saved in MongoDb as: "Bose®" (correct)
>
> Why does MongoDb do this? Why does it convert all & into &, even for
> entities like © -> &copy; (broken html) ?
I cannot reproduce this..
$ cat entity.php
<?php
$m = new Mongo();
$m->test->entities->insert(array("v" => "Bose®"), array("safe" => true));
var_dump($m->test->entities->findOne());
?>
$ php entity.php
array(2) {
["_id"]=>
object(MongoId)#6 (1) {
["$id"]=>
string(24) "5024d38e44415ed07b000000"
}
["v"]=>
string(9) "Bose®"
}
How does your code look like?
-Hannes