开发者

Encoding Issue?

开发者 https://www.devze.com 2023-03-21 17:52 出处:网络
I am having an issue with encoding (i think). In my code I am getting the current directory using this php code:

I am having an issue with encoding (i think).

In my code I am getting the current directory using this php code:

$path = realpath(dirname(__FILE__));

Which returns something like:

/Users/gprime/htdo开发者_C百科cs/loadrðt

But should return:

/Users/gprime/htdocs/loadr

I am guessing it has to do with encoding. That extra ðt that it appends should not be there. I tried to convert all files to UTF-8 which is for some reason causing this issue. Any help would be appreciated.

Thanks!


This looks like an encoding issue in the directory name, rather than the file content. Converting the file content to UTF-8 will not help - you need to rename the directory. Try renaming it to something random and then to loadr again.


I figured it out. The php.ini default-charset had to be set to UTF-8. After I did this everything worked :)

0

精彩评论

暂无评论...
验证码 换一张
取 消