newroco / emlviewer

nextcloud eml viewer plugin
GNU Affero General Public License v3.0
16 stars 3 forks source link

Template files are prepended by spurious control characters #50

Closed rotdrop closed 1 year ago

rotdrop commented 1 year ago
    And also
heinecj@nbnmh110:/var/www/html/nextcloud-git-25/apps/emlviewer$ for i in templates/*.php  ; do echo $i ; hexdump -c $i | head -n1 ; done
templates/email_headers.php
0000000 357 273 277   <   s   t   y   l   e   >  \n                   /
templates/emlcontent.php
0000000 357 273 277 357 273 277   <   ?   p   h   p  \n                
templates/error.php
0000000 357 273 277   <   ?   p   h   p       p   r   i   n   t   _   u
templates/index.php
0000000   <   ?   p   h   p  \n   $   e   v   e   n   t   D   i   s   p
templates/printcontent.php
0000000 357 273 277   <   ?   p   h   p       p   r   i   n   t   _   u

Originally posted by @rotdrop in https://github.com/newroco/emlviewer/issues/47#issuecomment-1380671568

rotdrop commented 1 year ago

Ok, it is the BOM:

https://stackoverflow.com/questions/24096871/reading-first-line-in-a-file-gives-me-a-357-273-277-prefix-in-the-first-row

If this is not stripped before passing it to mpdf then the checks in that package will fail resp, do fail. Is this some sort of crazy editor which does add theses prefixes?