0

I got error in Chrome in my XML file: https://media.mostrami.pl/feed/zanox.xml?asdfsadfa after upgrade from PHP 5 to 7.

error on line 148745 at column 26: Input is not proper UTF-8, indicate encoding !
Bytes: 0xC4 0x87 0x20 0x6A

I validated the file using xmllint and did not get any error. I'm pretty sure that the content is in UTF-8 (worked fine in PHP5, validated by xmllint, checked by file -I xml_filename)

What's wrong?

RobM
  • 432
  • 1
  • 4
  • 17
  • Possible duplicate of [Error: "Input is not proper UTF-8, indicate encoding !" using PHP's simplexml\_load\_string](http://stackoverflow.com/questions/2507608/error-input-is-not-proper-utf-8-indicate-encoding-using-phps-simplexml-lo) Check this out to determine if it answers your question. – dlporter98 Jun 14 '16 at 13:37
  • @dlporter98 I'm pretty sure that the content is in UTF-8 (worked fine in PHP5, validated by xmllint, checked by file -I xml_filename) – RobM Jun 14 '16 at 13:42
  • What is the offending character at "148745 at column 26". I pretty sure it will be that the character is not UTF-8 – dlporter98 Jun 14 '16 at 13:48
  • Line 148745 is: " <![CDATA[Rożek z alg morskich we wzór to propozycja od marki Camphora. Jest łatwy w użytkowaniu, samodzielnie regulujesz wielkość poprzez odpowiednie założenie dolnego rogu, jak również szerokość za pomocą wygodnych troczków. Gdy dziecko wyrośnie z rożka, z po..." – RobM Jun 14 '16 at 13:51
  • Try opening the files in an editor--see if the characters on this line display properly when the editor is set to display in UTF-8. – dlporter98 Jun 14 '16 at 13:56
  • Yes, every sign is displayed correctly. What is more the file opened locally works fine without any error in Chrome. – RobM Jun 14 '16 at 14:00
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/114660/discussion-between-dlporter98-and-robm). – dlporter98 Jun 14 '16 at 17:47
  • Please post that code that is processing this file and indicate the line number you are getting the error. I think the error is in how the file is being processed for php7 – dlporter98 Jun 14 '16 at 22:19

1 Answers1

1

I believe you encountered a streamed XML parsing bug in chrome. The error will point to the beginning of the XML tag, but in fact the „error” is somewhere further in the content. It is because the server responds in chunks, and one of those chunks were split in the middle of a multibyte UTF character.

Maciej Łebkowski
  • 3,837
  • 24
  • 32