utf-8 special characters not displaying

前端 未结 8 1352
暗喜
暗喜 2020-12-03 06:47

I moved my website from my local test server to NameCheap shared hosting and now I\'m running into a problem - some of the pages aren\'t displaying utf-8 special characters

8条回答
  •  半阙折子戏
    2020-12-03 07:39

    The problem is because your file are not with the same encoding. First run the following command in all your files:

    file -i filename.* 
    

    In order to fix the problem you have to change all your files to uft-8. You can do it with the command iconv:

    iconv -f fromcode -t tocode filename > newfilename
    

    Example:

    iconv -f iso-8859-1 -t utf-8 index.html > fixed/index.html
    

    After this you can run file -i fixedx/index.html and you will see that your file is now in uft-8

提交回复
热议问题