I am using PHP 5.6 on Windows IIS. When creating a link and uploading a file for that link through ckeditor, file name on server is not with special characters like: ČĆŽŠĐ. Problem is only when uploading files through ckeditor. When uploading text to database, there is no problem with the encoding. How can I make ckeditor to maybe tell server the right encoding, maybe to include encoding i request, or whatever I need to do to make it work? This PHP encoding is a nightmare!
I've fixed it with this:
iconv("utf-8", "cp1250", $_FILES['upload']['name'])
But, is there no way I can tell PHP to just treat everything as UTF-8? I've tried setting every single setting regarding encoding and codepage in php.ini to UTF-8 and it did not help. It really seems inconsistent and finicky. Any PHP experts that can tell me the simple solution to this mess?
These are the upload headers:
POST https://nsdmup-a.hr/cms/news_fileupload.php?CKEditor=fullText&CKEditorFuncNum=1&langCode=en HTTP/1.1
Host: nsdmup-a.hr
Connection: keep-alive
Content-Length: 1069214
Cache-Control: max-age=0
Origin: https://nsdmup-a.hr
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarysc0FA4jsjDe2Z4s8
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: https://nsdmup-a.hr/cms/news_add.php?editId=293
Accept-Encoding: gzip, deflate, br
Accept-Language: hr-HR,hr;q=0.9,en-US;q=0.8,en;q=0.7,sr;q=0.6,bs;q=0.5,ja;q=0.4
Cookie: PHPSESSID=45iuc1r017sb75bte57dl0te71
------WebKitFormBoundarysc0FA4jsjDe2Z4s8
Content-Disposition: form-data; name="upload"; filename="511-D-022-2018. dopis ministru - zapšljavanje namještenika2.pdf"
Content-Type: application/pdf
This is the file name he wrote to disk: "511-D-022-2018. dopis ministru - zapšljavanje namještenika2.pdf"