php fwrite doesn't doesn't create filenames as they are imported(ÅÄÖ becomes ääÃ)

131 views Asked by At

I'm using a form to send a subject and a message. I then remove all spaces from the subject using $subject = str_replace(" ", "_", $subject);

I then create a file using $file = fopen($subject, wb) The filename doesn't support the characters Å Ä and Ö. Instead they become ä ä and ö

When i echo $subject; it comes out normal.

I would prefer not having to replace them since I'm making a website for Swedish speaking people.

1

There are 1 answers

2
Guillaume Renoult On

Make sure your PHP file is properly encoded. I reckon it should be UTF8 but not sure for Swedish.