yuli chika
yuli chika

Reputation: 9221

Why do I get strange results when I get the Wikipedia API via PHP?

I'm using PHP to access the Wikipedia API. This is the URL I'm getting:

http://en.wikipedia.org/w/api.php?action=query&prop=revisions|links&titles=google&rvprop=ids|timestamp|user|comment|content&rvlimit=1&format=xml

The results are very strange:

garbled text

I added header('Content-type:text/html; charset=utf-8'); at the top of the page, but that didn't seem to help. Is this a character encoding issue?

Upvotes: 0

Views: 266

Answers (2)

Toby Allen
Toby Allen

Reputation: 11213

Some older versions of php dont support UTF-8 or unicode properly, perhaps ensure you are using an up to date version.

Upvotes: 0

Matti Virkkunen
Matti Virkkunen

Reputation: 65126

There's nothing wrong with your encoding (what you call the "unicode" for some reason) as I can see a few non-latin languages being displayed quite fine. You're just missing the fonts for the four languages you listed.

Upvotes: 1

Related Questions