0

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.

  • You can create your website with swedish characters, why do you need the internal files with swedish names? The visitors of your website don't need to see those files, so, don't use swedish chars for filenames. – Jose Manuel Abarca Rodríguez Jun 16 '15 at 23:13
  • Hey. The reason I need that is because my class mates will create "guides" for other classmates. They do so with a form and then it saves as "subject.php" gif: http://gfycat.com/SpiritedJealousGordonsetter – Alpha Kitten Jun 16 '15 at 23:37
  • I guess those "guides" are stored in database with a unique ID. Use the IDs as filenames. You will open the "guides" with their IDs, and show them on screen with the original swedish names. Nobody will know but you. – Jose Manuel Abarca Rodríguez Jun 16 '15 at 23:38

1 Answers1

0

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

  • I believe I have. I use `` and `` On every page – Alpha Kitten Jun 16 '15 at 23:23
  • 1
    This will output the HTML display as utf-8 but not the encoding of the file it self. For example in Notepad++ you can check in Encoding if it's correct. If it still doesn't work try this: http://stackoverflow.com/a/4839438/1145134 – Guillaume Renoult Jun 16 '15 at 23:26