linux中文文件名不能访问,求教,在线等。
以前windows的服务器被别人直接丢了很多中文文件名的图片,现在换到linux上面了,中文的图片就不能访问了,如http://www.gopalau.net/files/PPR/%E5%9B%BD%E7%8E%8B%E4%B8%8E%E7%8E%8B%E5%90%8E%E9%A4%90%E5%8E%85.jpg
网上找了很多,都说需要mod_encoding,但是按照相关方法还是不行,有些rpm也装不上,或是没有资源了。
我的服务器类型是:Apache/2.4.6 (CentOS) PHP/5.4.16
请问有没有什么方法能解决,谢谢了。
@xuzuning
回复讨论(解决方案)
%E5%9B%BD%E7%8E%8B%E4%B8%8E%E7%8E%8B%E5%90%8E%E9%A4%90%E5%8E%85.jpg
是 utf-8 的 国王与王后餐厅.jpg 的 url 编码
你在迁移服务器时注意到中文文件名的字符集了吗?
也就是说你的新服务器上的对应目录里有 国王与王后餐厅.jpg 这个文件吗?
从截图上开,你的 web 服务器是不支持中文 url 的(Apache 默认就是不支持中文 url 的)
%E5%9B%BD%E7%8E%8B%E4%B8%8E%E7%8E%8B%E5%90%8E%E9%A4%90%E5%8E%85.jpg
是 utf-8 的 国王与王后餐厅.jpg 的 url 编码
你在迁移服务器时注意到中文文件名的字符集了吗?
也就是说你的新服务器上的对应目录里有 国王与王后餐厅.jpg 这个文件吗?
从截图上开,你的 web 服务器是不支持中文 url 的(Apache 默认就是不支持中文 url 的)
有的,而且用迅雷下载也可以下载下来。
我的程序是 gbk 编码的
也就是说你在服务器上的中文文件名也是 gbk 编码的
你并没有如实反映情况!
你要按 gbk 中文做 url 编码
http://www.gopalau.net/files/PPR/%B9%FA%CD%F5%D3%EB%CD%F5%BA%F3%B2%CD%CC%FC.jpg
我的程序是 gbk 编码的
也就是说你在服务器上的中文文件名也是 gbk 编码的
你并没有如实反映情况!
之前因为直接从window打包压缩放到linux上面的,解压出来是乱码如:PPR-+-+-恽芯?++ャ鳞?使.jpg,所以我就直接再放了一个“国王与王后餐厅.jpg”上去,你说的是没有如实反映情况是什么呢?能告诉你需要我提供哪些信息呢?
你要按 gbk 中文做 url 编码
http://www.gopalau.net/files/PPR/%B9%FA%CD%F5%D3%EB%CD%F5%BA%F3%B2%CD%CC%FC.jpg
我也想过将url编码转换一下,但是图片全部是在文章里面隔三岔五的

能不能给我一个正则表达式,将内容里面的 urlencode(iconv("utf-8","gbk","祖宁.jpg")),谢谢老大。
我说你 没有如实反映情况,是因为:
你的中文文件名实际是 gbk 的,而你却说已经转成 utf-8 的了
你用 utf-8 的中文文件名,去访问 gbk 的中文文件,当然是找不到的
XZN
有没有办法修改liunx配置
服务器类型是:Apache/2.4.6 (CentOS) PHP/5.4.16
让直接可以以下面这个网址访问
http://www.gopalau.net/files/palasia-hotel-palau/帛琉大饭店游泳池.jpg (linux现在不能访问)
以前的
http://www.citssz.net/files/palasia-hotel-palau/帛琉大饭店游泳池.jpg(之前的windows可以访问)
为了跨平台还是建议不要用中文命名

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:
