URL / FTP服务器中的日文字符 [英] Japanese characters in URL/FTP server

查看:193
本文介绍了URL / FTP服务器中的日文字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>解决方案

主机名可能包含任何使用 IDN 的Unicode字符( Punycode码)。所以:

 例え。テスト
xn - r8jz45g.xn - zckzah

是同一网站。



URL的其他部分使用UTF -8和正常的URL编码。所以:

  http://例え。テスト/メインページ
http://xn--r8jz45g.xn - zckzah /%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8

是以 IRI URI



如果您在URL中包含用户名:密码,那么也会进行编码:

  ftp://使用:ftp.example.com / 
ftp://%E3%83%86%E3%82%B9%E3%83%88%E3%83%86%E3%82%B9% E3%83%88@ftp.example.com/

然而,这是否真的有效是另一回事。 FTP RFC没有提及任何有关编码的内容(稍后的RFC指定Unicode支持文件名,但这不适用于密码)。



FTP服务器通常是字节因此,要进行密码匹配,您必须发送与服务器接受的编码相同的编码,这通常是系统的默认编码。在现代Linux和OS X服务器上将是UTF-8;在Windows上,它将是一种特定于语言环境的编码,它永远不会是UTF-8。 (在日文Windows安装中,它将是代码页932,与shift-JIS类似)。



所以,可以,但它很重要不可靠和最好的避免。然后,再次,讨厌的不安全的旧FTP本身是最好的避免这些天。


Can URL or FTP server addresses contain Japanese characters?

How about an FTP username and password?

解决方案

Hostnames may contain any Unicode character using IDN (Punycode). So:

例え.テスト
xn--r8jz45g.xn--zckzah

are the same site.

Other parts of a URL are encoded using UTF-8 and normal URL-encoding. So:

http://例え.テスト/メインページ
http://xn--r8jz45g.xn--zckzah/%E3%83%A1%E3%82%A4%E3%83%B3%E3%83%9A%E3%83%BC%E3%82%B8

are the same address expressed as an IRI and a URI.

If you included a username:password in the URL that would also be encoded:

ftp://テスト:テスト@ftp.example.com/
ftp://%E3%83%86%E3%82%B9%E3%83%88:%E3%83%86%E3%82%B9%E3%83%88@ftp.example.com/

however whether this would actually work is another matter. The FTP RFC doesn't say anything about encodings (a later RFC specifies Unicode support for filenames, but this doesn't apply to passwords).

FTP servers are typically byte-based, so to make a password match you'd have to be sending the same encoding as the server accepts, which will typically be the system's default encoding. On modern Linux and OS X servers that'll be UTF-8; on Windows it'll be a locale-specific encoding which is never UTF-8. (On a Japanese Windows install it'll be code page 932, which is similar to shift-JIS.)

So, yeah, it could be done, but it's highly unreliable and best avoided. Then again, nasty insecure old FTP itself is best avoided these days.

这篇关于URL / FTP服务器中的日文字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆