php likes bom, codeforces don't

Revision en1, by moss3s, 2018-11-28 09:53:04

Hi. I'd like to tell you short story.

Do you like to get outcomes like this?

wrong answer 1st words differ - expected: '1/2', found: '1/2'

I was bit confused. 46296564

After short experiment i've got OK with exactly? same code: 46298129. Look inside, compare, are the sources same?

The only difference is in BOM (byte order mark, prefix 0xEF,0xBB,0xBF of file).

The first submission is source code in utf-8 with BOM, the second one has no BOM. It turns out, if source code contains BOM, php produces stdout with BOM, and of course checker can not parse it correctly.

Seems to be bug in php.

P.S. Please, don't ask, why php :D

Tags php, bom, fun, bug

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English moss3s 2018-11-28 09:53:04 805 Initial revision (published)