Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP encoding problem when copied to linux

Tags:

php

encoding

I'm editing a php file in Notepad++ in a german language under Windows 7 x64 Ulti. I'm encoding it with Encode in UFT-8 without BOM. On my WAMP server locally everything is displayed correctly. If I copy the file to a linux machine, and view the source, I see replaced characters like ö, ä, ü with some nonsense.

I also got this meta tag in header:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

If I check it with W3C validator, this error appears: "The character encoding specified in the HTTP header (iso-8859-1) is different from the value in the element (utf-8). I will use the value from the HTTP header (iso-8859-1) for this validation"

It is a free hosting on: funpic.org

Why is that please? Thank you

like image 215
theSpyCry Avatar asked Jun 20 '26 22:06

theSpyCry


1 Answers

Issue a header('Content-Type: text/html; charset=utf-8'); before displaying the HTML.

like image 97
bcosca Avatar answered Jun 22 '26 12:06

bcosca



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!