Gagaro
Gagaro

Reputation: 782

How to create a title with accents in a MediaWiki's extension?

I'm trying to dynamically create articles. The articles' title are made from names. Some name have accents in them (é, è, ç, ...).

For now I'm doing this:

$title = Title::newFromText($name[0] .' '. $name[1]);

But it return NULL where there is an accent.

How can I properly create the title and keep the accent in the article?

Upvotes: 2

Views: 142

Answers (1)

Gagaro
Gagaro

Reputation: 782

As Ilmari Karonen said, the string needs to be UTF-8 encoded. It now works:

$title = Title::newFromText(utf8_encode($name[0] .' '. $name[1]));

Upvotes: 1

Related Questions