开发者

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

开发者 https://www.devze.com 2023-02-07 07:21 出处:网络
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&开发者_如何学Goprop=revisions|links&titles=google&rvprop=ids|times

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&开发者_如何学Goprop=revisions|links&titles=google&rvprop=ids|timestamp|user|comment|content&rvlimit=1&format=xml

The results are very strange:

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

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?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消