开发者

Apache installation in folder with chinese characters in name

开发者 https://www.devze.com 2022-12-31 02:43 出处:网络
I would like to install an Apache server into a folder like c:\\anything\\思怞怟\\anything2\\ under windows.

I would like to install an Apache server into a folder like c:\anything\思怞怟\anything2\ under windows. When I try to start the se开发者_Go百科rvice it sais that:

httpd: Syntax error on line xx of C:/anything/\xe6\x80\x98\xe6\x80\x99\e6\80\9a/anything2/apache/conf/httpd.conf: ServerRoot must be a valid directory

Does anyone have a solution?


Does anyone have a solution?

Don't do that? :-)

Unicode filenames on Windows are a huge problem for software talking to the OS through byte-based interfaces, such as the C standard library (stdio) functions exposed by the MS CRT.

Whilst other platforms have mostly standardised on UTF-8 as the encoding for filenames, Windows uses the locale-specific system default code page (misleadingly known as ‘ANSI’). On a Western Windows install that will normally be code page 1252 (similar to ISO-8859-1); on a Chinese install you get code page 936 (similar to GB-2312). Files whose names do not fit completely within that code page — for example 思怞怟 on a Western machine, or Dobrý den on a Chinese machine — will simply be inaccessible.

You can change your system code page from Control Panel -> Regional Options -> Advanced -> Language for non-Unicode programs. However even if you chose cp936 to get the Chinese characters Apache appears to be trying to encode its filename to UTF-8 regardless. Unfortunately you can only choose from a limited range of the code pages that Windows defaults to in the different regions; you do not get UTF-8.

About the only way I can think of to get it to run from such a folder name would be to grab the old-school DOS 8.3 filename, which is ASCII-only. You can see the 8.3 filenames from the command-line using dir /x, if the feature is turned on in your filesystem. You might find the folder has an 8.3 name of something like F8D5~1. Invoke Apache from this path instead of 思怞怟 and it should at least start... though if you have any more non-ASCII filenames you're only going to get loads more problems.

0

精彩评论

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