Recent Posts | My Watched Topics | My Ignored Topics | Search

[BUG] Encoding errors in the API response Forum »» Support »» [BUG] Encoding errors in the API response

08-17-11, 3:48 AM

Joined: Apr 2011
Posts: 6
I noticed that sometimes the XML response contains invalid unicode.

For example this call:

returns as one of the titles: "Onegai My Melody Kirara�".
The actual title should be: "Onegai My Melody Sukkiri♪".

Someone one commented that this is probably because the wrong PHP function was used (htmlentities() instead of htmlspecialchars()).

For a more detailed desription see:
Modified by StackedCrooked, 08-17-11, 3:54 AM
08-17-11, 3:51 PM

Joined: May 2008
Posts: 4611
Yeah the encoding problems need to be addressed. Switching to htmlspecialchars() would certainly be less disruptive to the unicode portions of the data, and use of htmlentities() is the likely culprit. The xml feed is served as utf-8 so there is no reason to convert characters other than: < > ' " & ...and possibly invalid unicode (control characters and such, that should could just be stripped with iconv() or mb_convert_encoding()... or even a regular expression).

see also:
Help     FAQ     About     Contact     Terms     Privacy