Based on mb_detect_encoding(), "televisión"
appears to be a UTF-8 string, so you should not have any problem storing it in MongoDB. Indeed, I was able to insert it as both a key and a value into the database, from both PHP and the JavaScript shell.
Are you able to insert the document and retrieve it using PHP? Your example only showed the insertion step. Consider the following script:
$name = 'televisión';
$m = new MongoClient();
$c = $m->test->titles;
$c->insert(['name' => $name]);
var_dump($c->findOne(['name' => $name]));
This script prints the following on my system:
array(2) {
'_id' =>
class MongoId#6 (1) {
public $$id =>
string(24) "5213c3dbe84df10121873458"
}
'name' =>
string(11) "televisión"
}
Additionally, I'm able to query for the same document in the JavaScript shell:
> db.titles.find({name: "televisión"})
{ "_id" : ObjectId("5213c3dbe84df10121873458"), "name" : "televisión" }
It's possible that your terminal is simply having trouble displaying UTF-8 characters.